Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move unit-tests/ to tests/ #12348

Merged
merged 10 commits into from
Oct 23, 2016
20 changes: 20 additions & 0 deletions tests/_data/controllers/AboutController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

class AboutController
{
/**
* @Get("/about/team")
*/
public function teamAction()
{

}

/**
* @Post("/about/team")
*/
public function teamPostAction()
{

}
}
12 changes: 12 additions & 0 deletions tests/_data/controllers/MainController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

class MainController
{
/**
* @Get("/")
*/
public function indexAction()
{

}
}
28 changes: 28 additions & 0 deletions tests/_data/controllers/ProductsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

class ProductsController
{
/**
* @Get("/products")
*/
public function indexAction()
{

}

/**
* @Get("/products/edit/{id:[0-9]+}", name="edit-product")
*/
public function editAction($id)
{

}

/**
* @Route("/products/save", methods={"POST", "PUT"}, name="save-product")
*/
public function saveAction()
{

}
}
31 changes: 31 additions & 0 deletions tests/_data/controllers/RobotsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* @RoutePrefix("/robots")
*/
class RobotsController
{
/**
* @Get("/")
*/
public function indexAction()
{

}

/**
* @Get("/edit/{id:[0-9]+}", name="edit-robot")
*/
public function editAction($id)
{

}

/**
* @Route("/save", methods={"POST", "PUT"}, name="save-robot")
*/
public function saveAction()
{

}
}
59 changes: 59 additions & 0 deletions tests/_data/models/Boutique/Robots.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

namespace Phalcon\Test\Models\Boutique;

class Robots extends \Phalcon\Mvc\Model
{

const setterEpilogue = " setText";

/**
* @Primary
* @Identity
* @Column(type="integer", nullable=false)
*/
public $id;

/**
* @Column(type="string", length=70, nullable=false)
*/
public $name;

/**
* @Column(type="string", length=32, nullable=false, default='mechanical')
*/
public $type;

/**
* @Column(type="integer", nullable=false, default=1900)
*/
public $year;

/**
* @Column(type="datetime", nullable=false)
*/
public $datetime;

/**
* @Column(type="datetime", nullable=true)
*/
public $deleted;

/**
* @Column(type="text", nullable=false)
*/
protected $text;

/**
* Test restriction to not set hidden properties without setters.
*/
protected $serial;

public function getText() {
return $this->text;
}

public function setText($value) {
return ($this->text = $value . self::setterEpilogue);
}
}
40 changes: 40 additions & 0 deletions tests/_data/models/Boutique/Robotters.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace Phalcon\Test\Models\Boutique;

/**
* Robotters
*
* "robotters" is robots in danish
*/
class Robotters extends \Phalcon\Mvc\Model
{

/**
* @Primary
* @Identity
* @Column(type="integer", nullable=false, mappedColumn="id")
*/
public $code;

/**
* @Column(type="string", length=70, nullable=false, mappedColumn="id")
*/
public $theName;

/**
* @Column(type="string", length=32, nullable=false, mappedColumn="id")
*/
public $theType;

/**
* @Column(type="integer", nullable=false, mappedColumn="id")
*/
public $theYear;

public function getSource()
{
return 'robots';
}

}
40 changes: 40 additions & 0 deletions tests/_data/models/Deles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace Phalcon\Test\Models;

/**
* Deles
*
* Deles is "parts" in danish
*/
class Deles extends \Phalcon\Mvc\Model
{

public function getSource()
{
return 'parts';
}

public function columnMap()
{
return array(
'id' => 'code',
'name' => 'theName',
);
}

public function initialize()
{
$this->hasMany(
'code',
RobottersDeles::class,
'delesCode',
array(
'foreignKey' => array(
'message' => 'Deles cannot be deleted because is referenced by a Robotter'
)
)
);
}

}
43 changes: 43 additions & 0 deletions tests/_data/models/Robotters.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Phalcon\Test\Models;

/**
* Robotters
*
* "robotters" is robots in danish
*/
class Robotters extends \Phalcon\Mvc\Model
{

public function getSource()
{
return 'robots';
}

public function columnMap()
{
return array(
'id' => 'code',
'name' => 'theName',
'type' => 'theType',
'year' => 'theYear',
'datetime' => 'theDatetime',
'deleted' => 'theDeleted',
'text' => 'theText'
);
}

public function initialize()
{
$this->hasMany(
'code',
RobottersDeles::class,
'robottersCode',
array(
'foreignKey' => true
)
);
}

}
51 changes: 51 additions & 0 deletions tests/_data/models/RobottersDeles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace Phalcon\Test\Models;

/**
* RobottersDeles
*
* This model is an intermediate table for "Robotters" and "Deles"
*/
class RobottersDeles extends \Phalcon\Mvc\Model
{

public function getSource()
{
return 'robots_parts';
}

public function columnMap()
{
return array(
'id' => 'code',
'robots_id' => 'robottersCode',
'parts_id' => 'delesCode',
);
}

public function initialize()
{

$this->belongsTo(
'delesCode',
Deles::class,
'code',
array(
'foreignKey' => true
)
);

$this->belongsTo(
'robottersCode',
Robotters::class,
'code',
array(
'foreignKey' => array(
'message' => 'The robotters code does not exist'
)
)
);
}

}
1 change: 1 addition & 0 deletions tests/_data/views/layouts/after.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="after-layout"><?php echo $this->getContent(); ?></div>
1 change: 1 addition & 0 deletions tests/_data/views/layouts/before.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="before-layout"><?php echo $this->getContent(); ?></div>
1 change: 1 addition & 0 deletions tests/_data/views/layouts/test13.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="controller-layout"><?php echo $this->getContent(); ?></div>
1 change: 1 addition & 0 deletions tests/_data/views/test13/index.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="action">Action</div>
1 change: 1 addition & 0 deletions tests/_data/views/test16/index.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php echo isset($this->getView()->set_param); ?>
Loading