You are here

public function LoggerDataCollectorTest::testCollect in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php \Symfony\Component\HttpKernel\Tests\DataCollector\LoggerDataCollectorTest::testCollect()

@dataProvider getCollectTestData

File

vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php, line 21

Class

LoggerDataCollectorTest

Namespace

Symfony\Component\HttpKernel\Tests\DataCollector

Code

public function testCollect($nb, $logs, $expectedLogs, $expectedDeprecationCount, $expectedScreamCount, $expectedPriorities = null) {
  $logger = $this
    ->getMock('Symfony\\Component\\HttpKernel\\Log\\DebugLoggerInterface');
  $logger
    ->expects($this
    ->once())
    ->method('countErrors')
    ->will($this
    ->returnValue($nb));
  $logger
    ->expects($this
    ->exactly(2))
    ->method('getLogs')
    ->will($this
    ->returnValue($logs));
  $c = new LoggerDataCollector($logger);
  $c
    ->lateCollect();
  $this
    ->assertSame('logger', $c
    ->getName());
  $this
    ->assertSame($nb, $c
    ->countErrors());
  $this
    ->assertSame($expectedLogs ?: $logs, $c
    ->getLogs());
  $this
    ->assertSame($expectedDeprecationCount, $c
    ->countDeprecations());
  $this
    ->assertSame($expectedScreamCount, $c
    ->countScreams());
  if (isset($expectedPriorities)) {
    $this
      ->assertSame($expectedPriorities, $c
      ->getPriorities());
  }
}