Permalink
Browse files

add test case

  • Loading branch information...
dereuromark committed May 14, 2013
1 parent 0822578 commit 9fd2af96a87c079483b01ce26cad180015bdb9c9
Showing with 23 additions and 0 deletions.
  1. +23 −0 lib/Cake/Test/Case/Controller/ControllerTest.php
@@ -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;
}
@@ -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
*

0 comments on commit 9fd2af9

Please sign in to comment.