Skip to content
Permalink
Browse files

Adding test case for bake output.

  • Loading branch information...
markstory committed May 17, 2009
1 parent 0839462 commit c0f06be65e0d54003f1d643224170c3d165ce4ce
Showing with 26 additions and 0 deletions.
  1. +26 −0 cake/tests/cases/console/libs/tasks/controller.test.php
@@ -199,5 +199,31 @@ function testConfirmController() {
$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);
}
}
?>

0 comments on commit c0f06be

Please sign in to comment.
You can’t perform that action at this time.