Przeglądaj źródła

Added logger name getter, Monolog\Logger::getName()
Added phpunit.xml to .gitignore to prevent contributors from accidentally commiting theirs.

Artem Nezvigin 14 lat temu
rodzic
commit
f31388ec42
3 zmienionych plików z 18 dodań i 0 usunięć
  1. 1 0
      .gitignore
  2. 7 0
      src/Monolog/Logger.php
  3. 10 0
      tests/Monolog/LoggerTest.php

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+phpunit.xml

+ 7 - 0
src/Monolog/Logger.php

@@ -92,6 +92,13 @@ class Logger
         $this->name = $name;
     }
 
+    /**
+     * @return string
+     */
+    public function getName() {
+        return $this->name;
+    }
+
     /**
      * Pushes an handler on the stack.
      *

+ 10 - 0
tests/Monolog/LoggerTest.php

@@ -16,6 +16,16 @@ use Monolog\Handler\TestHandler;
 
 class LoggerTest extends \PHPUnit_Framework_TestCase
 {
+
+    /**
+     * @covers Monolog\Logger::getName()
+     */
+    public function testGetName()
+    {
+        $logger = new Logger('foo');
+        $this->assertEquals('foo', $logger->getName());
+    }
+
     /**
      * @covers Monolog\Logger::__construct
      */