From 9f3a9e6d78e6a2db9cdd2035e17e7ca61c682f7b Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 16 Jul 2009 08:51:06 -0400 Subject: [PATCH] Adding test case for BakeShell and bake all --- cake/tests/cases/console/libs/bake.test.php | 109 ++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 cake/tests/cases/console/libs/bake.test.php diff --git a/cake/tests/cases/console/libs/bake.test.php b/cake/tests/cases/console/libs/bake.test.php new file mode 100644 index 00000000000..22b813fbbf3 --- /dev/null +++ b/cake/tests/cases/console/libs/bake.test.php @@ -0,0 +1,109 @@ +Dispatch =& new BakeShellMockShellDispatcher(); + $this->Shell =& new MockBakeShell(); + $this->Shell->Dispatch =& $this->Dispatcher; + $this->Shell->Dispatch->shellPaths = App::path('shells'); + } +/** + * test bake all + * + * @return void + **/ + function testAllWithModelName() { + $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('Article Model was baked.')); + $this->Shell->expectAt(2, 'out', array('Article Controller was baked.')); + $this->Shell->expectAt(3, 'out', array('Article Views were baked.')); + $this->Shell->expectAt(4, 'out', array('Bake All complete')); + + $this->Shell->params = array(); + $this->Shell->args = array('Article', 'exitvalue'); + $this->Shell->all(); + } +} \ No newline at end of file