summaryrefslogtreecommitdiff
path: root/vendor/monolog/monolog/tests/Monolog/RegistryTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/monolog/monolog/tests/Monolog/RegistryTest.php')
-rw-r--r--vendor/monolog/monolog/tests/Monolog/RegistryTest.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/vendor/monolog/monolog/tests/Monolog/RegistryTest.php b/vendor/monolog/monolog/tests/Monolog/RegistryTest.php
new file mode 100644
index 00000000..29925f8a
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/RegistryTest.php
@@ -0,0 +1,63 @@
+<?php
+
+/*
+ * This file is part of the Monolog package.
+ *
+ * (c) Jordi Boggiano <j.boggiano@seld.be>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+
+class RegistryTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ Registry::clear();
+ }
+
+ /**
+ * @dataProvider hasLoggerProvider
+ * @covers Monolog\Registry::hasLogger
+ */
+ public function testHasLogger(array $loggersToAdd, array $loggersToCheck, array $expectedResult)
+ {
+ foreach ($loggersToAdd as $loggerToAdd) {
+ Registry::addLogger($loggerToAdd);
+ }
+ foreach ($loggersToCheck as $index => $loggerToCheck) {
+ $this->assertSame($expectedResult[$index], Registry::hasLogger($loggerToCheck));
+ }
+ }
+
+ public function hasLoggerProvider()
+ {
+ $logger1 = new Logger('test1');
+ $logger2 = new Logger('test2');
+ $logger3 = new Logger('test3');
+
+ return array(
+ // only instances
+ array(
+ array($logger1),
+ array($logger1, $logger2),
+ array(true, false),
+ ),
+ // only names
+ array(
+ array($logger1),
+ array('test1', 'test2'),
+ array(true, false),
+ ),
+ // mixed case
+ array(
+ array($logger1, $logger2),
+ array('test1', $logger2, 'test3', $logger3),
+ array(true, true, false, false),
+ ),
+ );
+ }
+}