当前位置: 首页>>代码示例>>PHP>>正文


PHP LoggerInterface::expects方法代码示例

本文整理汇总了PHP中Psr\Log\LoggerInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerInterface::expects方法的具体用法?PHP LoggerInterface::expects怎么用?PHP LoggerInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Psr\Log\LoggerInterface的用法示例。


在下文中一共展示了LoggerInterface::expects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testAdd

 public function testAdd()
 {
     $this->varReaderWriter->expects($this->once())->method('isExist')->willReturn(false);
     $this->varReaderWriter->expects($this->once())->method('writeFile');
     $this->logger->expects($this->once())->method('log')->with(\Psr\Log\LogLevel::ERROR, 'test1');
     $this->status->add('test1', \Psr\Log\LogLevel::ERROR);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:StatusTest.php

示例2: setUp

 protected function setUp()
 {
     $this->logger = $this->getMock('Psr\\Log\\LoggerInterface', array('info', 'error'));
     $this->logger->expects($this->any())->method('info');
     $this->logger->expects($this->any())->method('error');
     $this->adapter = new BraintreeSubscriptionAdapter($this->logger, 'sandbox', MERCHANTID, PUBLICKEY, PRIVATEKEY, 'Kairos\\SubscriptionBundle\\Tests\\TestEntities\\TransactionEntity');
 }
开发者ID:vik0803,项目名称:SubscriptionBundle,代码行数:7,代码来源:BraintreeSubscriptionAdapterTest.php

示例3: testBeforeDispatchWithException

 public function testBeforeDispatchWithException()
 {
     $exception = new LocalizedException(new Phrase('Phrase'));
     $this->themeRegistration->expects($this->once())->method('register')->willThrowException($exception);
     $this->logger->expects($this->once())->method('critical');
     $this->plugin->beforeDispatch($this->abstractAction, $this->request);
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:7,代码来源:RegistrationTest.php

示例4: testBeforeExecuteWithException

 public function testBeforeExecuteWithException()
 {
     $exception = new LocalizedException(new Phrase('Phrase'));
     $this->themeRegistration->expects($this->once())->method('register')->willThrowException($exception);
     $this->logger->expects($this->once())->method('critical');
     $object = new Registration($this->themeRegistration, $this->logger, $this->appState);
     $object->beforeExecute($this->abstractAction, $this->request);
 }
开发者ID:nblair,项目名称:magescotch,代码行数:8,代码来源:RegistrationTest.php

示例5: testUpdateDbWithException

 public function testUpdateDbWithException()
 {
     $this->databaseConfig->expects($this->once())->method('isAutoUpdate')->willReturn(true);
     $e = new \Exception();
     $this->updaterSelected->expects($this->once())->method('update')->willThrowException($e);
     $this->logger->expects($this->once())->method('critical')->with($e);
     $this->assertSame($this->cronUpdateDb, $this->cronUpdateDb->execute());
 }
开发者ID:ytorbyk,项目名称:magento2-geo-ip2,代码行数:8,代码来源:UpdateDbTest.php

示例6: testSendEmailWhenRedirectUrlExists

 public function testSendEmailWhenRedirectUrlExists()
 {
     $this->paymentMock->expects($this->once())->method('getOrderPlaceRedirectUrl')->willReturn(false);
     $this->orderMock->expects($this->once())->method('getCanSendNewEmailFlag');
     $this->orderSenderMock->expects($this->never())->method('send');
     $this->loggerMock->expects($this->never())->method('critical');
     $this->model->execute($this->observerMock);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:8,代码来源:SubmitObserverTest.php

示例7: testCall

 /**
  * Make sure publish is logged.
  */
 public function testCall()
 {
     $this->innerDriver->expects(self::once())->method('call')->willReturn(new Promise(function () {
         return new Response('');
     }));
     $this->logger->expects(self::exactly(2))->method('debug');
     $this->driver->call(new Identity(''), new Request(''))->resolve();
 }
开发者ID:skolodyazhnyy,项目名称:service-bus,代码行数:11,代码来源:LoggerDecoratorDriverTest.php

示例8: testServiceNotListening

 public function testServiceNotListening()
 {
     $this->logger->expects($this->once())->method('info');
     $this->logger->expects($this->once())->method('warning');
     $this->connection->expects($this->any())->method('isServiceListening')->will($this->returnValue(false));
     $listener = new PheanstalkLogListener();
     $listener->setLogger($this->logger);
     $listener->onCommand(new CommandEvent($this->pheanstalk, []), CommandEvent::PEEK_READY);
 }
开发者ID:michalmrzyk,项目名称:LeezyPheanstalkBundle,代码行数:9,代码来源:PheanstalkLogListenerTest.php

示例9: testIndexActionException

 public function testIndexActionException()
 {
     $this->request->expects($this->once())->method('isPost')->will($this->returnValue(true));
     $exception = new \Exception();
     $this->request->expects($this->once())->method('getPostValue')->will($this->throwException($exception));
     $this->logger->expects($this->once())->method('critical')->with($this->identicalTo($exception));
     $this->response->expects($this->once())->method('setHttpResponseCode')->with(500);
     $this->model->executeInternal();
 }
开发者ID:nblair,项目名称:magescotch,代码行数:9,代码来源:IndexTest.php

示例10: testReorderChildElementLog

 /**
  * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $loggerExpects
  * @param string $stateMode
  * @return void
  * @dataProvider reorderChildElementLogDataProvider
  */
 public function testReorderChildElementLog($loggerExpects, $stateMode)
 {
     $parentName = 'parent';
     $childName = 'child';
     $offsetOrSibling = '-';
     $this->stateMock->expects($this->once())->method('getMode')->willReturn($stateMode);
     $this->loggerMock->expects($loggerExpects)->method('critical')->with("Broken reference: the '{$childName}' tries to reorder itself towards '', but " . "their parents are different: '{$parentName}' and '' respectively.");
     $this->dataStructure->reorderChildElement($parentName, $childName, $offsetOrSibling);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:StructureTest.php

示例11: testApplyThemeCustomizationException

 public function testApplyThemeCustomizationException()
 {
     $file = $this->getMock('Magento\\Theme\\Model\\Theme\\File', [], [], '', false);
     $file->expects($this->any())->method('getCustomizationService')->willThrowException(new \InvalidArgumentException());
     $this->themeCustomization->expects($this->once())->method('getFiles')->will($this->returnValue([$file]));
     $this->logger->expects($this->once())->method('critical');
     $observer = new \Magento\Framework\Event\Observer();
     $this->themeObserver->execute($observer);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:9,代码来源:ApplyThemeCustomizationObserverTest.php

示例12: testExecuteQueryThrowsExceptionOnExecuteError

 /**
  * @expectedException \Assertis\SimpleDatabase\SimpleDatabaseExecuteException
  */
 public function testExecuteQueryThrowsExceptionOnExecuteError()
 {
     $sql = "SQL";
     $params = ['foo' => 'bar'];
     $this->pdo->expects($this->once())->method('prepare')->with($sql)->willReturn($this->statement);
     $this->statement->expects($this->once())->method('execute')->with($params)->willReturn(false);
     $this->logger->expects($this->once())->method('error');
     $db = new SimpleDatabase($this->pdo, $this->logger);
     $db->executeQuery($sql, $params);
 }
开发者ID:assertis,项目名称:simpledatabase-lib,代码行数:13,代码来源:SimpleDatabaseTest.php

示例13: testDone

 public function testDone()
 {
     $jobId = 12345;
     $this->pheanstalkMock->expects($this->once())->method('delete')->with($this->callback(function (Job $job) use($jobId) {
         return $job->getId() === $jobId;
     }));
     $this->pheanstalkMock->expects($this->any())->method('peek')->with($jobId)->willReturn(new Job($jobId, 'asdf'));
     $this->loggerMock->expects($this->once())->method('info')->with('Done job (12345): asdf');
     $this->sut->done($jobId);
 }
开发者ID:nickel715,项目名称:personal-queue,代码行数:10,代码来源:JobDealerTest.php

示例14: testGetFilesEmpty

 public function testGetFilesEmpty()
 {
     $this->libraryFilesMock->expects($this->any())->method('getFiles')->will($this->returnValue([]));
     $this->baseFilesMock->expects($this->any())->method('getFiles')->will($this->returnValue([]));
     $this->overriddenBaseFilesMock->expects($this->any())->method('getFiles')->will($this->returnValue([]));
     $aggregated = new Aggregated($this->fileListFactoryMock, $this->libraryFilesMock, $this->baseFilesMock, $this->overriddenBaseFilesMock, $this->loggerMock);
     $this->themeMock->expects($this->any())->method('getInheritedThemes')->will($this->returnValue([]));
     $this->themeMock->expects($this->any())->method('getCode')->will($this->returnValue('theme_code'));
     $this->loggerMock->expects($this->once())->method('notice')->with('magento_import returns empty result by path * for theme theme_code', []);
     $aggregated->getFiles($this->themeMock, '*');
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:AggregatedTest.php

示例15: testExecuteWithException

 public function testExecuteWithException()
 {
     $this->requestMock->expects($this->once())->method('getParam')->with('item_id', null)->willReturn('1');
     $exception = new \Exception('Error message!');
     $this->sidebarMock->expects($this->once())->method('checkQuoteItem')->with(1)->willThrowException($exception);
     $this->loggerMock->expects($this->once())->method('critical')->with($exception)->willReturn(null);
     $this->sidebarMock->expects($this->once())->method('getResponseData')->with('Error message!')->willReturn(['success' => false, 'error_message' => 'Error message!']);
     $this->jsonHelperMock->expects($this->once())->method('jsonEncode')->with(['success' => false, 'error_message' => 'Error message!'])->willReturn('json encoded');
     $this->responseMock->expects($this->once())->method('representJson')->with('json encoded')->willReturn('json represented');
     $this->assertEquals('json represented', $this->removeItem->executeInternal());
 }
开发者ID:nblair,项目名称:magescotch,代码行数:11,代码来源:RemoveItemTest.php


注:本文中的Psr\Log\LoggerInterface::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。