/** * setup */ public function setUp() { $this->command = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Command\\GearmanWorkerListCommand')->setMethods(null)->getMock(); $this->input = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputInterface')->disableOriginalConstructor()->setMethods(array())->getMock(); $this->output = $this->getMockBuilder('Symfony\\Component\\Console\\Output\\OutputInterface')->disableOriginalConstructor()->setMethods(array())->getMock(); $this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->disableOriginalConstructor()->setMethods(array())->getMock(); $this->gearmanClient = $this->getMockBuilder('Mmoreram\\GearmanBundle\\Service\\GearmanClient')->disableOriginalConstructor()->setMethods(array('getWorkers'))->getMock(); $this->gearmanClient->expects($this->any())->method('getWorkers')->will($this->returnValue(array(array('className' => '', 'callableName' => '', 'jobs' => array())))); $this->kernel->expects($this->any())->method('getEnvironment')->will($this->returnValue('dev')); }
/** * Test quietness * * @dataProvider dataQuietness */ public function testQuietness($quiet, $noInteraction, $confirmation, $countWriteln, $countDescriber, $countClient, $countExecute) { $this->input->expects($this->any())->method('getOption')->will($this->returnValueMap(array(array('quiet', $quiet), array('no-interaction', $noInteraction)))); $this->questionHelper->expects($this->any())->method('ask')->will($this->returnValue($confirmation)); $this->output->expects($countWriteln)->method('writeln'); $this->gearmanDescriber->expects($countDescriber)->method('describeJob')->will($this->returnValue('olakase')); $this->gearmanClient->expects($countClient)->method('getJob')->will($this->returnValue(array())); $this->gearmanExecute->expects($countExecute)->method('executeJob'); $this->command->setGearmanClient($this->gearmanClient)->setGearmanDescriber($this->gearmanDescriber)->setGearmanExecute($this->gearmanExecute)->setKernel($this->kernel)->run($this->input, $this->output); }