Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding tests for ProjectTask::execute().

  • Loading branch information...
commit 9627af2050a3552ee2930d395cc101aba5ac0701 1 parent a364e37
@markstory markstory authored
Showing with 29 additions and 0 deletions.
  1. +29 −0 cake/tests/cases/console/libs/tasks/project.test.php
View
29 cake/tests/cases/console/libs/tasks/project.test.php
@@ -80,6 +80,7 @@ function endTest() {
$Folder =& new Folder($this->Task->path . 'bake_test_app');
$Folder->delete();
}
+
/**
* creates a test project that is used for testing project task.
*
@@ -91,6 +92,7 @@ function _setupTestProject() {
$this->Task->setReturnValueAt(1, 'in', 'n');
$this->Task->bake($this->Task->path . 'bake_test_app', $skel);
}
+
/**
* test bake() method and directory creation.
*
@@ -128,6 +130,7 @@ function testSecuritySaltGeneration() {
$contents = $file->read();
$this->assertNoPattern('/DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi/', $contents, 'Default Salt left behind. %s');
}
+
/**
* test getAdmin method, and that it returns Routing.admin or writes to config file.
*
@@ -146,5 +149,31 @@ function testGetAdmin() {
$result = $this->Task->getAdmin();
$this->assertEqual($result, 'super_duper_admin_');
}
+
+/**
+ * Test execute method with one param to destination folder.
+ *
+ * @return void
+ **/
+ function testExecute() {
+ $this->Task->params['skel'] = CAKE_CORE_INCLUDE_PATH . DS . CONSOLE_LIBS . 'templates' . DS . 'skel';
+ $this->Task->params['working'] = TMP . 'tests' . DS;
+
+ $path = $this->Task->path . 'bake_test_app';
+ $this->Task->setReturnValue('in', 'y');
+ $this->Task->setReturnValueAt(0, 'in', $path);
+
+ $this->Task->execute();
+ $this->assertTrue(is_dir($path), 'No project dir %s');
+ $this->assertTrue(is_dir($path . DS . 'controllers'), 'No controllers dir %s');
+ $this->assertTrue(is_dir($path . DS . 'controllers' . DS .'components'), 'No components dir %s');
+ $this->assertTrue(is_dir($path . DS . 'models'), 'No models dir %s');
+ $this->assertTrue(is_dir($path . DS . 'views'), 'No views dir %s');
+ $this->assertTrue(is_dir($path . DS . 'views' . DS . 'helpers'), 'No helpers dir %s');
+ $this->assertTrue(is_dir($path . DS . 'tests'), 'No tests dir %s');
+ $this->assertTrue(is_dir($path . DS . 'tests' . DS . 'cases'), 'No cases dir %s');
+ $this->assertTrue(is_dir($path . DS . 'tests' . DS . 'groups'), 'No groups dir %s');
+ $this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir %s');
+ }
}
?>
Please sign in to comment.
Something went wrong with that request. Please try again.