You are here

public function LoggerInterfaceTest::testContextCanContainAnything in Lockr 7.3

File

vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php, line 102

Class

LoggerInterfaceTest
Provides a base test class for ensuring compliance with the LoggerInterface.

Namespace

Psr\Log\Test

Code

public function testContextCanContainAnything() {
  $closed = fopen('php://memory', 'r');
  fclose($closed);
  $context = array(
    'bool' => true,
    'null' => null,
    'string' => 'Foo',
    'int' => 0,
    'float' => 0.5,
    'nested' => array(
      'with object' => new DummyTest(),
    ),
    'object' => new \DateTime(),
    'resource' => fopen('php://memory', 'r'),
    'closed' => $closed,
  );
  $this
    ->getLogger()
    ->warning('Crazy context data', $context);
  $expected = array(
    'warning Crazy context data',
  );
  $this
    ->assertEquals($expected, $this
    ->getLogs());
}