mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
add test case
This commit is contained in:
parent
0822578813
commit
9fd2af96a8
1 changed files with 23 additions and 0 deletions
|
@ -360,6 +360,13 @@ class TestComponent extends Object {
|
||||||
|
|
||||||
class Test2Component extends TestComponent {
|
class Test2Component extends TestComponent {
|
||||||
|
|
||||||
|
public $model;
|
||||||
|
|
||||||
|
public function __construct(ComponentCollection $collection, $settings) {
|
||||||
|
$this->controller = $collection->getController();
|
||||||
|
$this->model = $this->controller->modelClass;
|
||||||
|
}
|
||||||
|
|
||||||
public function beforeRender(Controller $controller) {
|
public function beforeRender(Controller $controller) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -526,6 +533,22 @@ class ControllerTest extends CakeTestCase {
|
||||||
$this->assertTrue(is_a($Controller->TestPluginPost, 'TestPluginPost'));
|
$this->assertTrue(is_a($Controller->TestPluginPost, 'TestPluginPost'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testConstructClassesWithComponents method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testConstructClassesWithComponents() {
|
||||||
|
$Controller = new TestPluginController(new CakeRequest(), new CakeResponse());
|
||||||
|
$Controller->uses = array('NameTest');
|
||||||
|
$Controller->components[] = 'Test2';
|
||||||
|
|
||||||
|
$Controller->constructClasses();
|
||||||
|
$this->assertEquals('NameTest', $Controller->Test2->model);
|
||||||
|
$this->assertEquals('Name', $Controller->NameTest->name);
|
||||||
|
$this->assertEquals('Name', $Controller->NameTest->alias);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testAliasName method
|
* testAliasName method
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue