Browse Source

[ZF-10769] Zend_Log

- Fixed the assignment of  the option "facility".

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23467 44c647ce-9c0f-0410-b52a-842ac1e357ba
ramon 15 năm trước cách đây
mục cha
commit
604b349f54
2 tập tin đã thay đổi với 19 bổ sung2 xóa
  1. 1 1
      library/Zend/Log/Writer/Syslog.php
  2. 18 1
      tests/Zend/Log/Writer/SyslogTest.php

+ 1 - 1
library/Zend/Log/Writer/Syslog.php

@@ -103,7 +103,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract
 
         $runInitializeSyslog = true;
         if (isset($params['facility'])) {
-            $this->_facility = $this->setFacility($params['facility']);
+            $this->setFacility($params['facility']);
             $runInitializeSyslog = false;
         }
 

+ 18 - 1
tests/Zend/Log/Writer/SyslogTest.php

@@ -108,8 +108,25 @@ class Zend_Log_Writer_SyslogTest extends PHPUnit_Framework_TestCase
 
         $this->assertTrue($instance instanceof Zend_Log_Writer_Syslog);
     }
+
+    /**
+     * @group ZF-10769
+     */
+    public function testPastFacilityViaConstructor()
+    {
+        $writer = new WriterSyslogCustom(array('facility' => LOG_USER));
+        $this->assertEquals(LOG_USER, $writer->getFacility());
+    }
+}
+
+class WriterSyslogCustom extends Zend_Log_Writer_Syslog
+{
+    public function getFacility()
+    {
+        return $this->_facility;
+    }
 }
 
 if (PHPUnit_MAIN_METHOD == 'Zend_Log_Writer_SyslogTest::main') {
     Zend_Log_Writer_SyslogTest::main();
-}
+}