コード例 #1
0
 public function testCollect()
 {
     $c = new LoggerDataCollector(new TestLogger());
     $c->collect(new Request(), new Response());
     $this->assertSame('logger', $c->getName());
     $this->assertSame(1337, $c->countErrors());
     $this->assertSame(array('foo'), $c->getLogs());
 }
コード例 #2
0
 /**
  * @dataProvider getCollectTestData
  */
 public function testCollect($nb, $logs, $expected)
 {
     $logger = $this->getMock('Symfony\\Component\\HttpKernel\\Log\\DebugLoggerInterface');
     $logger->expects($this->once())->method('countErrors')->will($this->returnValue($nb));
     $logger->expects($this->once())->method('getLogs')->will($this->returnValue($logs));
     $c = new LoggerDataCollector($logger);
     $c->collect(new Request(), new Response());
     $this->assertSame('logger', $c->getName());
     $this->assertSame($nb, $c->countErrors());
     $this->assertSame($expected ? $expected : $logs, $c->getLogs());
 }