Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed May 14, 2013
1 parent 0822578 commit 9fd2af9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/Cake/Test/Case/Controller/ControllerTest.php
Expand Up @@ -360,6 +360,13 @@ public function beforeRender(Controller $controller) {

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) {
return false;
}
Expand Down Expand Up @@ -526,6 +533,22 @@ public function testConstructClasses() {
$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
*
Expand Down

0 comments on commit 9fd2af9

Please sign in to comment.