From c0f06be65e0d54003f1d643224170c3d165ce4ce Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 17 May 2009 00:04:33 -0400 Subject: [PATCH] Adding test case for bake output. --- .../console/libs/tasks/controller.test.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/cake/tests/cases/console/libs/tasks/controller.test.php b/cake/tests/cases/console/libs/tasks/controller.test.php index 2bdab3f88..5bec03b8b 100644 --- a/cake/tests/cases/console/libs/tasks/controller.test.php +++ b/cake/tests/cases/console/libs/tasks/controller.test.php @@ -199,5 +199,31 @@ class ControllerTaskTest extends CakeTestCase { $this->Task->expectAt(5, 'out', array("Uses:\n\tComment, User")); $this->Task->confirmController($controller, $scaffold, $uses, $helpers, $components); } + +/** + * test the bake method + * + * @return void + **/ + function testBake() { + $helpers = array('Ajax', 'Time'); + $components = array('Acl', 'Auth'); + $uses = array('Comment', 'User'); + $this->Task->setReturnValue('createFile', true); + + $result = $this->Task->bake('Articles', '--actions--', $helpers, $components, $uses); + $this->assertPattern('/class ArticlesController extends AppController/', $result); + $this->assertPattern('/\$components \= array\(\'Acl\', \'Auth\'\)/', $result); + $this->assertPattern('/\$uses \= array\(\'Article\', \'Comment\', \'User\'\)/', $result); + $this->assertPattern('/\$helpers \= array\(\'Html\', \'Form\', \'Ajax\', \'Time\'\)/', $result); + $this->assertPattern('/\-\-actions\-\-/', $result); + + $result = $this->Task->bake('Articles', 'scaffold', $helpers, $components, $uses); + $this->assertPattern('/class ArticlesController extends AppController/', $result); + $this->assertPattern('/var \$scaffold/', $result); + $this->assertNoPattern('/helpers/', $result); + $this->assertNoPattern('/components/', $result); + $this->assertNoPattern('/uses/', $result); + } } ?> \ No newline at end of file