本文整理汇总了PHP中Symfony\Component\Process\Process::method方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::method方法的具体用法?PHP Process::method怎么用?PHP Process::method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Process\Process
的用法示例。
在下文中一共展示了Process::method方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testProcessFailure
/**
* Test proper behavior if process is not successful
*/
public function testProcessFailure()
{
$command = rand();
$this->process->method('isSuccessful')->willReturn(false);
$this->process->method('getCommandLine')->willReturn($command);
$logger = $this->getMock('\\Psr\\Log\\LoggerInterface');
$logger->expects($this->at(0))->method('warning')->with('Problem executing command');
$logger->expects($this->at(1))->method('warning')->with('Details: `' . $command . '`');
$this->fixture->setLogger($logger);
$actual = $this->fixture->decode(null, null);
$this->assertFalse($actual);
}
示例2: testParsing
/**
* Test that non-empty return values are properly parsed
*
* @param string $return Simulated output from Avahi
* @param string $logList List of strings logged as a warning
* @param string $expected Expected result from find
*
* @dataProvider testParsingProvider
*/
public function testParsing($return, $logList, $expected)
{
$this->process->method('isSuccessful')->willReturn(true);
$this->process->method('getOutput')->willReturn($return);
$logger = $this->getMock('\\Psr\\Log\\LoggerInterface');
$this->fixture->setLogger($logger);
foreach ($logList as $index => $message) {
$logger->expects($this->at($index))->method('warning')->with($message);
}
$actual = $this->fixture->find();
$this->assertEquals($expected, $actual);
}