ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
RegistryTest.php
Go to the documentation of this file.
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
12namespace Monolog;
13
14
16{
17 protected function setUp()
18 {
19 Registry::clear();
20 }
21
26 public function testHasLogger(array $loggersToAdd, array $loggersToCheck, array $expectedResult)
27 {
28 foreach ($loggersToAdd as $loggerToAdd) {
29 Registry::addLogger($loggerToAdd);
30 }
31 foreach ($loggersToCheck as $index => $loggerToCheck) {
32 $this->assertSame($expectedResult[$index], Registry::hasLogger($loggerToCheck));
33 }
34 }
35
36 public function hasLoggerProvider()
37 {
38 $logger1 = new Logger('test1');
39 $logger2 = new Logger('test2');
40 $logger3 = new Logger('test3');
41
42 return array(
43 // only instances
44 array(
45 array($logger1),
46 array($logger1, $logger2),
47 array(true, false),
48 ),
49 // only names
50 array(
51 array($logger1),
52 array('test1', 'test2'),
53 array(true, false),
54 ),
55 // mixed case
56 array(
57 array($logger1, $logger2),
58 array('test1', $logger2, 'test3', $logger3),
59 array(true, true, false, false),
60 ),
61 );
62 }
63}
Monolog log channel.
Definition: Logger.php:28
testHasLogger(array $loggersToAdd, array $loggersToCheck, array $expectedResult)
@dataProvider hasLoggerProvider @covers Monolog\Registry::hasLogger