Dispatcher =& new TestTestTaskMockShellDispatcher(); $this->Dispatcher->shellPaths = Configure::read('shellPaths'); $this->Task =& new MockViewTask($this->Dispatcher); $this->Task->Dispatch =& $this->Dispatcher; $this->Task->Template =& new TemplateTask($this->Dispatcher); } /** * tearDown method * * @return void * @access public */ function endTest() { ClassRegistry::flush(); } /** * Test getContent and parsing of Templates. * * @return void **/ function testGetContent() { $vars = array( 'modelClass' => 'TestViewModel', 'schema' => array(), 'primaryKey' => 'id', 'displayField' => 'name', 'singularVar' => 'testViewModel', 'pluralVar' => 'testViewModels', 'singularHumanName' => 'Test View Model', 'pluralHumanName' => 'Test View Models', 'fields' => array('id', 'name', 'body'), 'associations' => array() ); $result = $this->Task->getContent('view', $vars); $this->assertPattern('/Delete Test View Model/', $result); $this->assertPattern('/Edit Test View Model/', $result); $this->assertPattern('/List Test View Models/', $result); $this->assertPattern('/New Test View Model/', $result); $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result); $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result); $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result); } } ?>