本文整理匯總了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());
}
示例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'));
}