/** * shell_exec() mock to capture invocation parameters for the actual \shell_exec() function * * @param $command * @return string */ function shell_exec($command) { $output = ExecRecorder::$execOutput[ExecRecorder::$execCalled]; ExecRecorder::$execCalled++; ExecRecorder::$execCommand = $command; return $output; }
/** * @test */ public function extractMetaDataUsesMParameter() { ExecRecorder::setReturnExecOutput(array('foo')); $file = new File(array('identifier' => 'testWORD.doc', 'name' => 'testWORD.doc'), $this->documentsStorageMock); $service = new AppService($this->getConfiguration()); $service->extractMetaData($file); $this->assertContains('-m', ExecRecorder::$execCommand); }
/** * @test */ public function stopStopsProcess() { $process = new Process('/usr/bin/foo', '-bar'); $process->setPid(1337); ExecRecorder::setReturnExecOutput(array('1337 /usr/bin/foo -bar')); $running = $process->isRunning(); $this->assertTrue($running); $stopped = $process->stop(); $this->assertTrue($stopped); $running = $process->isRunning(); $this->assertFalse($running); }