Dispatcher =& new TestProjectTaskMockShellDispatcher(); $this->Dispatcher->shellPaths = Configure::read('shellPaths'); $this->Task =& new MockProjectTask($this->Dispatcher); $this->Task->Dispatch =& $this->Dispatcher; $this->Task->path = TMP . 'tests' . DS; } /** * tearDown method * * @return void * @access public */ function endTest() { ClassRegistry::flush(); $Folder =& new Folder($this->Task->path . 'bake_test_app'); $Folder->delete(); } /** * test bake() method and directory creation. * * @return void **/ function testBake() { $skel = CAKE_CORE_INCLUDE_PATH . DS . CONSOLE_LIBS . 'templates' . DS . 'skel'; $this->Task->setReturnValueAt(0, 'in', 'y'); $this->Task->setReturnValueAt(1, 'in', 'n'); $this->Task->bake($this->Task->path . 'bake_test_app', $skel); $path = $this->Task->path . 'bake_test_app'; $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'); } /** * test generation of Security.salt * * @return void **/ function testSecuritySaltGeneration() { $skel = CAKE_CORE_INCLUDE_PATH . DS . CONSOLE_LIBS . 'templates' . DS . 'skel'; $this->Task->setReturnValueAt(0, 'in', 'y'); $this->Task->setReturnValueAt(1, 'in', 'n'); $this->Task->bake($this->Task->path . 'bake_test_app', $skel); $path = $this->Task->path . 'bake_test_app' . DS; $result = $this->Task->securitySalt($path); $this->assertTrue($result); $file =& new File($path . 'config' . DS . 'core.php'); $contents = $file->read(); $this->assertNoPattern('/DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi/', $contents, 'Default Salt left behind. %s'); } } ?>