Permalink
Browse files

Additional tests for execute

  • Loading branch information...
1 parent 6eada28 commit e8eaf97dcfc04789bbc1ead574df3a0ac5ac1f46 @markstory markstory committed May 20, 2009
Showing with 45 additions and 0 deletions.
  1. +45 −0 cake/tests/cases/console/libs/tasks/controller.test.php
@@ -334,6 +334,7 @@ function testInteractive() {
$filename = '/my/path/articles_controller.php';
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticlesController/')));
}
+
/**
* test that execute runs all when the first arg == all
*
@@ -353,5 +354,49 @@ function testExecuteIntoAll() {
$this->Task->execute();
}
+
+/**
+ * test that `cake bake controller foo scaffold` works.
+ *
+ * @return void
+ **/
+ function testExecuteWithScaffoldParam() {
+ $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Execute with scaffold param requires no Article model to be defined. %s');
+ if ($skip) {
+ return;
+ }
+ $this->Task->connection = 'test_suite';
+ $this->Task->path = '/my/path/';
+ $this->Task->args = array('Articles', 'scaffold');
+
+ $filename = '/my/path/articles_controller.php';
+ $this->Task->expectAt(0, 'createFile', array(
+ $filename, new NoPatternExpectation('/admin_index/')
+ ));
+
+ $this->Task->execute();
+ }
+
+/**
+ * test that `cake bake controller foo scaffold admin` works
+ *
+ * @return void
+ **/
+ function testExecuteWithAdminScaffoldParams() {
+ $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Execute with scaffold admin param requires no Article model to be defined. %s');
+ if ($skip) {
+ return;
+ }
+ $this->Task->connection = 'test_suite';
+ $this->Task->path = '/my/path/';
+ $this->Task->args = array('Articles', 'scaffold', 'admin');
+
+ $filename = '/my/path/articles_controller.php';
+ $this->Task->expectAt(0, 'createFile', array(
+ $filename, new PatternExpectation('/admin_index/')
+ ));
+
+ $this->Task->execute();
+ }
}
?>

0 comments on commit e8eaf97

Please sign in to comment.