Dispatch =& new BakeShellMockShellDispatcher(); $this->Shell =& new MockBakeShell(); $this->Shell->Dispatch =& $this->Dispatch; $this->Shell->Dispatch->shellPaths = App::path('shells'); } /** * endTest method * * @return void * @access public */ function endTest() { unset($this->Dispatch, $this->Shell); } /** * test bake all * * @return void * @access public */ function testAllWithModelName() { App::import('Model', 'User'); $userExists = class_exists('User'); if ($this->skipIf($userExists, 'User class exists, cannot test `bake all [param]`. %s')) { return; } $this->Shell->Model =& new BakeShellMockModelTask(); $this->Shell->Controller =& new BakeShellMockControllerTask(); $this->Shell->View =& new BakeShellMockModelTask(); $this->Shell->DbConfig =& new BakeShellMockDbConfigTask(); $this->Shell->DbConfig->expectOnce('getConfig'); $this->Shell->DbConfig->setReturnValue('getConfig', 'test_suite'); $this->Shell->Model->setReturnValue('bake', true); $this->Shell->Model->expectNever('getName'); $this->Shell->Model->expectOnce('bake'); $this->Shell->Controller->expectOnce('bake'); $this->Shell->Controller->setReturnValue('bake', true); $this->Shell->View->expectOnce('execute'); $this->Shell->expectAt(0, 'out', array('Bake All')); $this->Shell->expectAt(1, 'out', array('User Model was baked.')); $this->Shell->expectAt(2, 'out', array('User Controller was baked.')); $this->Shell->expectAt(3, 'out', array('User Views were baked.')); $this->Shell->expectAt(4, 'out', array('Bake All complete')); $this->Shell->params = array(); $this->Shell->args = array('User'); $this->Shell->all(); } }