當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Process::method方法代碼示例

本文整理匯總了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);
 }
開發者ID:jimlind,項目名稱:tivo-php,代碼行數:15,代碼來源:VideoDecoderTest.php

示例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);
 }
開發者ID:jimlind,項目名稱:tivo-php,代碼行數:21,代碼來源:TiVoFinderTest.php


注:本文中的Symfony\Component\Process\Process::method方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。