当前位置: 首页>>代码示例>>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;未经允许,请勿转载。