30 $this->assertInstanceOf(
'Psr\Log\LoggerInterface', $this->
getLogger());
39 $logger->{$level}($message, array(
'user' =>
'Bob'));
40 $logger->log($level, $message, array(
'user' =>
'Bob'));
43 $level.
' message of level '.$level.
' with context: Bob',
44 $level.
' message of level '.$level.
' with context: Bob',
46 $this->assertEquals($expected, $this->
getLogs());
69 $logger->log(
'invalid level',
'Foo');
75 $logger->info(
'{Message {nothing} {user} {foo.bar} a}', array(
'user' =>
'Bob',
'foo.bar' =>
'Bar'));
77 $expected = array(
'info {Message {nothing} Bob Bar a}');
78 $this->assertEquals($expected, $this->
getLogs());
83 $dummy = $this->getMock(
'Psr\Log\Test\DummyTest', array(
'__toString'));
84 $dummy->expects($this->once())
85 ->method(
'__toString')
86 ->will($this->returnValue(
'DUMMY'));
99 'nested' => array(
'with object' =>
new DummyTest),
100 'object' =>
new \DateTime,
101 'resource' => fopen(
'php://memory',
'r'),
104 $this->
getLogger()->warning(
'Crazy context data', $context);
109 $this->
getLogger()->warning(
'Random message', array(
'exception' =>
'oops'));
110 $this->
getLogger()->critical(
'Uncaught Exception!', array(
'exception' =>
new \LogicException(
'Fail')));
testContextCanContainAnything()
testLogsAtAllLevels($level, $message)
provideLevelsAndMessages
provideLevelsAndMessages()
testContextExceptionKeyCanBeExceptionOrOtherValues()
getLogs()
This must return the log messages in order with a simple formatting: "<LOG LEVEL> <MESSAGE>"...
testThrowsOnInvalidLevel()
Psr
Provides a base test class for ensuring compliance with the LoggerInterface.