/** * @covers Monolog\Handler\GroupHandler::handleBatch */ public function testHandleBatch() { $testHandlers = array(new TestHandler(), new TestHandler()); $handler = new GroupHandler($testHandlers); $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); foreach ($testHandlers as $test) { $this->assertTrue($test->hasDebugRecords()); $this->assertTrue($test->hasInfoRecords()); $this->assertTrue(count($test->getRecords()) === 2); } }
/** * @covers Monolog\Handler\GroupHandler::handle */ public function testHandleBatchUsesProcessors() { $testHandlers = array(new TestHandler(), new TestHandler()); $handler = new GroupHandler($testHandlers); $handler->pushProcessor(function ($record) { $record['extra']['foo'] = true; return $record; }); $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); foreach ($testHandlers as $test) { $this->assertTrue($test->hasDebugRecords()); $this->assertTrue($test->hasInfoRecords()); $this->assertTrue(count($test->getRecords()) === 2); $records = $test->getRecords(); $this->assertTrue($records[0]['extra']['foo']); $this->assertTrue($records[1]['extra']['foo']); } }