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()); }
/** * @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()); }