add test case

This commit is contained in:
euromark 2013-05-14 10:38:10 +02:00
parent 0822578813
commit 9fd2af96a8

View file

@ -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
* *