1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-13 08:34:12 +02:00

Add TagProcessor::addTags and TagProcessor::setTags, fixes #588

This commit is contained in:
Jordi Boggiano
2015-07-12 11:55:38 +01:00
parent b941eac988
commit 66532794b0
2 changed files with 30 additions and 0 deletions

View File

@@ -26,4 +26,24 @@ class TagProcessorTest extends TestCase
$this->assertEquals($tags, $record['extra']['tags']);
}
/**
* @covers Monolog\Processor\TagProcessor::__invoke
*/
public function testProcessorTagModification()
{
$tags = array(1, 2, 3);
$processor = new TagProcessor($tags);
$record = $processor($this->getRecord());
$this->assertEquals($tags, $record['extra']['tags']);
$processor->setTags(array('a', 'b'));
$record = $processor($this->getRecord());
$this->assertEquals(array('a', 'b'), $record['extra']['tags']);
$processor->addTags(array('a', 'c'));
$record = $processor($this->getRecord());
$this->assertEquals(array('a', 'b', 'c'), $record['extra']['tags']);
}
}