當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。