ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Monolog\RegistryTest Class Reference
+ Inheritance diagram for Monolog\RegistryTest:
+ Collaboration diagram for Monolog\RegistryTest:

Public Member Functions

 testHasLogger (array $loggersToAdd, array $loggersToCheck, array $expectedResult)
 hasLoggerProvider Monolog::hasLogger More...
 
 hasLoggerProvider ()
 
 testClearClears ()
 Monolog::clear More...
 
 testRemovesLogger ($loggerToAdd, $remove)
 removedLoggerProvider Monolog::addLogger Monolog::removeLogger More...
 
 removedLoggerProvider ()
 
 testGetsSameLogger ()
 Monolog::addLogger Monolog::getInstance Monolog::__callStatic More...
 
 testFailsOnNonExistantLogger ()
 Monolog::getInstance More...
 
 testReplacesLogger ()
 Monolog::addLogger More...
 
 testFailsOnUnspecifiedReplacement ()
 Monolog::addLogger More...
 

Protected Member Functions

 setUp ()
 

Detailed Description

Definition at line 14 of file RegistryTest.php.

Member Function Documentation

◆ hasLoggerProvider()

Monolog\RegistryTest::hasLoggerProvider ( )

Definition at line 35 of file RegistryTest.php.

36  {
37  $logger1 = new Logger('test1');
38  $logger2 = new Logger('test2');
39  $logger3 = new Logger('test3');
40 
41  return array(
42  // only instances
43  array(
44  array($logger1),
45  array($logger1, $logger2),
46  array(true, false),
47  ),
48  // only names
49  array(
50  array($logger1),
51  array('test1', 'test2'),
52  array(true, false),
53  ),
54  // mixed case
55  array(
56  array($logger1, $logger2),
57  array('test1', $logger2, 'test3', $logger3),
58  array(true, true, false, false),
59  ),
60  );
61  }

◆ removedLoggerProvider()

Monolog\RegistryTest::removedLoggerProvider ( )

Definition at line 89 of file RegistryTest.php.

90  {
91  $logger1 = new Logger('test1');
92 
93  return array(
94  array($logger1, $logger1),
95  array($logger1, 'test1'),
96  );
97  }

◆ setUp()

Monolog\RegistryTest::setUp ( )
protected

Definition at line 16 of file RegistryTest.php.

17  {
19  }
static clear()
Clears the registry.
Definition: Registry.php:101

◆ testClearClears()

Monolog\RegistryTest::testClearClears ( )

Monolog::clear

Definition at line 66 of file RegistryTest.php.

67  {
68  Registry::addLogger(new Logger('test1'), 'log');
70 
71  $this->setExpectedException('\InvalidArgumentException');
72  Registry::getInstance('log');
73  }
static getInstance($name)
Gets Logger instance from the registry.
Definition: Registry.php:113
static addLogger(Logger $logger, $name=null, $overwrite=false)
Adds new logging channel to the registry.
Definition: Registry.php:55
static clear()
Clears the registry.
Definition: Registry.php:101

◆ testFailsOnNonExistantLogger()

Monolog\RegistryTest::testFailsOnNonExistantLogger ( )

Monolog::getInstance

Definition at line 120 of file RegistryTest.php.

121  {
122  Registry::getInstance('test1');
123  }
static getInstance($name)
Gets Logger instance from the registry.
Definition: Registry.php:113

◆ testFailsOnUnspecifiedReplacement()

Monolog\RegistryTest::testFailsOnUnspecifiedReplacement ( )

Monolog::addLogger

Definition at line 144 of file RegistryTest.php.

145  {
146  $log1 = new Logger('test1');
147  $log2 = new Logger('test2');
148 
149  Registry::addLogger($log1, 'log');
150 
151  Registry::addLogger($log2, 'log');
152  }
static addLogger(Logger $logger, $name=null, $overwrite=false)
Adds new logging channel to the registry.
Definition: Registry.php:55

◆ testGetsSameLogger()

Monolog\RegistryTest::testGetsSameLogger ( )

Monolog::addLogger Monolog::getInstance Monolog::__callStatic

Definition at line 104 of file RegistryTest.php.

105  {
106  $logger1 = new Logger('test1');
107  $logger2 = new Logger('test2');
108 
109  Registry::addLogger($logger1, 'test1');
110  Registry::addLogger($logger2);
111 
112  $this->assertSame($logger1, Registry::getInstance('test1'));
113  $this->assertSame($logger2, Registry::test2());
114  }
static getInstance($name)
Gets Logger instance from the registry.
Definition: Registry.php:113
static addLogger(Logger $logger, $name=null, $overwrite=false)
Adds new logging channel to the registry.
Definition: Registry.php:55

◆ testHasLogger()

Monolog\RegistryTest::testHasLogger ( array  $loggersToAdd,
array  $loggersToCheck,
array  $expectedResult 
)

hasLoggerProvider Monolog::hasLogger

Definition at line 25 of file RegistryTest.php.

References $index.

26  {
27  foreach ($loggersToAdd as $loggerToAdd) {
28  Registry::addLogger($loggerToAdd);
29  }
30  foreach ($loggersToCheck as $index => $loggerToCheck) {
31  $this->assertSame($expectedResult[$index], Registry::hasLogger($loggerToCheck));
32  }
33  }
static hasLogger($logger)
Checks if such logging channel exists by name or instance.
Definition: Registry.php:71
static addLogger(Logger $logger, $name=null, $overwrite=false)
Adds new logging channel to the registry.
Definition: Registry.php:55
$index
Definition: metadata.php:60

◆ testRemovesLogger()

Monolog\RegistryTest::testRemovesLogger (   $loggerToAdd,
  $remove 
)

removedLoggerProvider Monolog::addLogger Monolog::removeLogger

Definition at line 80 of file RegistryTest.php.

81  {
82  Registry::addLogger($loggerToAdd);
83  Registry::removeLogger($remove);
84 
85  $this->setExpectedException('\InvalidArgumentException');
86  Registry::getInstance($loggerToAdd->getName());
87  }
static getInstance($name)
Gets Logger instance from the registry.
Definition: Registry.php:113
static addLogger(Logger $logger, $name=null, $overwrite=false)
Adds new logging channel to the registry.
Definition: Registry.php:55
static removeLogger($logger)
Removes instance from registry by name or instance.
Definition: Registry.php:87

◆ testReplacesLogger()

Monolog\RegistryTest::testReplacesLogger ( )

Monolog::addLogger

Definition at line 128 of file RegistryTest.php.

129  {
130  $log1 = new Logger('test1');
131  $log2 = new Logger('test2');
132 
133  Registry::addLogger($log1, 'log');
134 
135  Registry::addLogger($log2, 'log', true);
136 
137  $this->assertSame($log2, Registry::getInstance('log'));
138  }
static getInstance($name)
Gets Logger instance from the registry.
Definition: Registry.php:113
static addLogger(Logger $logger, $name=null, $overwrite=false)
Adds new logging channel to the registry.
Definition: Registry.php:55

The documentation for this class was generated from the following file: