]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php
MediaWiki 1.30.2
[autoinstalls/mediawiki.git] / vendor / monolog / monolog / tests / Monolog / Processor / TagProcessorTest.php
1 <?php
2
3 /*
4  * This file is part of the Monolog package.
5  *
6  * (c) Jordi Boggiano <j.boggiano@seld.be>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Monolog\Processor;
13
14 use Monolog\TestCase;
15
16 class TagProcessorTest extends TestCase
17 {
18     /**
19      * @covers Monolog\Processor\TagProcessor::__invoke
20      */
21     public function testProcessor()
22     {
23         $tags = array(1, 2, 3);
24         $processor = new TagProcessor($tags);
25         $record = $processor($this->getRecord());
26
27         $this->assertEquals($tags, $record['extra']['tags']);
28     }
29
30     /**
31      * @covers Monolog\Processor\TagProcessor::__invoke
32      */
33     public function testProcessorTagModification()
34     {
35         $tags = array(1, 2, 3);
36         $processor = new TagProcessor($tags);
37
38         $record = $processor($this->getRecord());
39         $this->assertEquals($tags, $record['extra']['tags']);
40
41         $processor->setTags(array('a', 'b'));
42         $record = $processor($this->getRecord());
43         $this->assertEquals(array('a', 'b'), $record['extra']['tags']);
44
45         $processor->addTags(array('a', 'c', 'foo' => 'bar'));
46         $record = $processor($this->getRecord());
47         $this->assertEquals(array('a', 'b', 'a', 'c', 'foo' => 'bar'), $record['extra']['tags']);
48     }
49 }