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


PHP LoggerInterface::shouldReceive方法代碼示例

本文整理匯總了PHP中Psr\Log\LoggerInterface::shouldReceive方法的典型用法代碼示例。如果您正苦於以下問題:PHP LoggerInterface::shouldReceive方法的具體用法?PHP LoggerInterface::shouldReceive怎麽用?PHP LoggerInterface::shouldReceive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Psr\Log\LoggerInterface的用法示例。


在下文中一共展示了LoggerInterface::shouldReceive方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: it_should_log_the_query_if_logger_has_been_set

 /**
  * @test
  */
 public function it_should_log_the_query_if_logger_has_been_set()
 {
     $logger = new Psr3SqlLogger($this->logger, LogLevel::INFO);
     $this->logger->shouldReceive('log')->with(LogLevel::INFO, 'Execute SQL', ['query' => '', 'params' => [], 'types' => null])->once();
     $logger->startQuery('', [], null);
     $logger->stopQuery();
 }
開發者ID:remi-san,項目名稱:doctrine-tools,代碼行數:10,代碼來源:Psr3SqlLoggerTest.php

示例2: setUp

 /**
  *
  */
 protected function setUp()
 {
     $this->logger = \Mockery::mock('\\Psr\\Log\\LoggerInterface');
     $this->logger->shouldReceive('log')->withAnyArgs();
     // helper function
     $this->futureFunc = function (array $response) {
         return function (array $request) use($response) {
             return new CompletedFutureArray($response);
         };
     };
     // basic response
     $this->response = ['status' => 200, 'effective_url' => 'http://localhost', 'transfer_stats' => ['total_time' => 0]];
 }
開發者ID:hitmeister,項目名稱:api-sdk-php,代碼行數:16,代碼來源:ProcessResponseTest.php

示例3: testHandleWithParsingErrorWithoutMessage

 /**
  * @test
  */
 public function testHandleWithParsingErrorWithoutMessage()
 {
     $userId = $this->getApplicationUserId(42);
     $userName = 'Arthur';
     $user = \Mockery::mock(ParsingUser::class, function ($user) use($userId, $userName) {
         $user->shouldReceive('getId')->andReturn($userId);
         $user->shouldReceive('getName')->andReturn($userName);
         $user->shouldReceive('getAccount')->andReturn(\Mockery::mock(Account::class));
     });
     $message = new \stdClass();
     $exception = \Mockery::mock('\\MessageApp\\Parser\\Exception\\MessageParserException');
     $exception->shouldReceive('getUser')->andReturn($user);
     $parser = \Mockery::mock('\\MessageApp\\Parser\\MessageParser');
     $parser->shouldReceive('parse')->andThrow($exception);
     $this->logger->shouldReceive('info')->twice();
     $this->logger->shouldReceive('error')->once();
     $this->logger->shouldReceive('warning')->once();
     $this->messageSender->shouldReceive('send')->never();
     $this->factory->shouldReceive('buildMessage')->with(\Mockery::on(function ($users) {
         $this->assertCount(1, $users);
         $this->assertInstanceOf(UndefinedApplicationUser::class, $users[0]);
         return true;
     }), $exception)->andReturn(null);
     $hangmanApp = new MessageApplication($this->messageSender, $parser, $this->factory, $this->getCommandBus());
     $hangmanApp->setLogger($this->logger);
     $hangmanApp->handle($message);
 }
開發者ID:remi-san,項目名稱:message-app,代碼行數:30,代碼來源:MessageAppTest.php

示例4: testErrorLogLevelCanBeCustomized

 /**
  * @expectedException \League\Tactician\Logger\Tests\Fixtures\UserAlreadyExistsException
  */
 public function testErrorLogLevelCanBeCustomized()
 {
     $middleware = new LoggerMiddleware($this->formatter, $this->logger, LogLevel::DEBUG, LogLevel::DEBUG, LogLevel::CRITICAL);
     $this->formatter->shouldReceive('commandReceived')->andReturn('received');
     $this->formatter->shouldReceive('commandFailed')->andReturn('failed');
     $this->logger->shouldReceive('log')->with(LogLevel::DEBUG, 'received');
     $this->logger->shouldReceive('log')->with(LogLevel::CRITICAL, 'failed');
     $middleware->execute(new RegisterUserCommand(), function () {
         throw new UserAlreadyExistsException();
     });
 }
開發者ID:RonRademaker,項目名稱:tactician-logger,代碼行數:14,代碼來源:LoggerMiddlewareTest.php

示例5: mockFinishApiCall

 private function mockFinishApiCall()
 {
     $this->apiTimeCalculator->shouldReceive('calculateEarliestNextCall')->with($this->apiCall)->andReturn(self::EARLIEST_NEXT_CALL);
     $this->apiCall->shouldReceive('setEarliestNextCall')->with(self::EARLIEST_NEXT_CALL);
     $this->logger->shouldReceive('info');
 }
開發者ID:Bavragor,項目名稱:eveapi-fetcher-bundle,代碼行數:6,代碼來源:ApiUpdaterTest.php


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