Dispatcher =& new TestTemplateTaskMockShellDispatcher(); $this->Task =& new MockTemplateTask($this->Dispatcher); $this->Task->Dispatch = new $this->Dispatcher; $this->Task->Dispatch->shellPaths = Configure::read('shellPaths'); } /** * tearDown method * * @return void * @access public */ function endTest() { unset($this->Task, $this->Dispatcher); ClassRegistry::flush(); } /** * test that set sets variables * * @return void **/ function testSet() { $this->Task->set('one', 'two'); $this->assertTrue(isset($this->Task->templateVars['one'])); $this->assertEqual($this->Task->templateVars['one'], 'two'); $this->Task->set(array('one' => 'three', 'four' => 'five')); $this->assertTrue(isset($this->Task->templateVars['one'])); $this->assertEqual($this->Task->templateVars['one'], 'three'); $this->assertTrue(isset($this->Task->templateVars['four'])); $this->assertEqual($this->Task->templateVars['four'], 'five'); } /** * test Initialize * * @return void **/ function testInitialize() { $this->Task->initialize(); $this->assertEqual($this->Task->templatePaths, $this->Task->Dispatch->shellPaths); } /** * test generate * * @return void **/ function testGenerate() { $this->Task->templatePaths = array( TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS . 'shells' . DS ); $result = $this->Task->generate('objects', 'test_object', array('test' => 'foo')); $expected = "I got rendered\nfoo"; $this->assertEqual($result, $expected); } } ?>