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


PHP TestHandler::hasDebugThatContains方法代碼示例

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


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

示例1: testInstanceWithLogger

 /**
  * Test instance with Monolog passed.
  *
  * @throws \WebservicesNl\Common\Exception\Client\InputException
  * @throws \InvalidArgumentException
  * @throws \WebservicesNl\Common\Exception\Server\NoServerAvailableException
  */
 public function testInstanceWithLogger()
 {
     $handler = new TestHandler();
     $logger = new Logger('unit-test', [$handler]);
     $config = new PlatformConfig();
     $factory = SoapFactory::build($config);
     $factory->setLogger($logger);
     $soapClient = $factory->create(['username' => 'johndoe', 'password' => 'fakePassword']);
     static::assertAttributeInstanceOf('\\Psr\\Log\\LoggerInterface', 'logger', $factory);
     static::assertTrue($factory->hasLogger());
     static::assertAttributeInstanceOf('\\Psr\\Log\\LoggerInterface', 'logger', $soapClient);
     static::assertTrue($handler->hasInfoThatContains('Created SoapClient for Webservices'));
     static::assertTrue($handler->hasDebugThatContains('Created SoapClient'));
     static::assertInstanceOf('WebservicesNl\\Protocol\\Soap\\Config\\Platform\\Webservices\\Converter', $soapClient->getConverter());
 }
開發者ID:webservices-nl,項目名稱:platform-connector,代碼行數:22,代碼來源:SoapClientFactoryTest.php

示例2: testParseOriginInvalidString

 /**
  * Test the parseOrigin with values
  * Uses reflection as this is a protected method.
  *
  * @test
  * @covers \Bairwell\MiddlewareCors\Traits\Parse::parseOrigin
  */
 public function testParseOriginInvalidString()
 {
     $sut = new MiddlewareCors();
     // setup the logger
     $this->logger = new Logger('test');
     $this->testLogger = new TestHandler();
     $this->logger->pushHandler($this->testLogger);
     $sut->setLogger($this->logger);
     //
     $reflection = new \ReflectionClass(get_class($sut));
     $settingsProperty = $reflection->getProperty('settings');
     $settingsProperty->setAccessible(true);
     $method = $reflection->getMethod('parseOrigin');
     $method->setAccessible(true);
     $request = $this->getMockBuilder('Psr\\Http\\Message\\ServerRequestInterface')->disableOriginalConstructor()->getMock();
     $request->expects($this->once())->method('getHeaderLine')->with('origin')->willReturn(123);
     $result = $method->invokeArgs($sut, [$request]);
     $this->assertSame('', $result);
     // check the logger
     $this->assertTrue($this->testLogger->hasDebugThatContains('Origin is empty or is not a string'));
 }
開發者ID:bairwell,項目名稱:middleware-cors,代碼行數:28,代碼來源:ParseTest.php


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