/** * Verify correct dispatch of Shell subclasses without a main method * * @return void */ public function testDispatchShellWithoutMain() { $Dispatcher = new TestShellDispatcher(); $Shell = $this->getMock('Shell', array(), array(&$Dispatcher), 'MockWithoutMainShell'); $Shell = new MockWithoutMainShell($Dispatcher); $this->mockObjects[] = $Shell; $Shell->expects($this->once())->method('initialize'); $Shell->expects($this->once())->method('loadTasks'); $Shell->expects($this->once())->method('runCommand')->with('initdb', array('initdb'))->will($this->returnValue(true)); $Dispatcher->TestShell = $Shell; $Dispatcher->args = array('mock_without_main', 'initdb'); $result = $Dispatcher->dispatch(); $this->assertTrue($result); }