Просмотр исходного кода

ZF-8520: use identical matching when checking for option keys in resources

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19647 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 лет назад
Родитель
Сommit
7d64dc1f51

+ 1 - 1
library/Zend/Application/Resource/ResourceAbstract.php

@@ -92,7 +92,7 @@ abstract class Zend_Application_Resource_ResourceAbstract implements Zend_Applic
             if (method_exists($this, $method)) {
                 $this->$method($value);
             }
-            if ('bootstrap' == $key) {
+            if ('bootstrap' === $key) {
                 unset($options[$key]);
             }
         }

+ 16 - 0
tests/Zend/Application/Resource/ResourceAbstractTest.php

@@ -178,6 +178,22 @@ class Zend_Application_Resource_ResourceAbstractTest extends PHPUnit_Framework_T
         $options = $resource->getOptions();
         $this->assertNotContains('bootstrap', array_keys($options));
     }
+
+    /**
+     * @group ZF-8520
+     */
+    public function testFirstResourceOptionShouldNotBeDropped()
+    {
+        require_once dirname(__FILE__) . '/../_files/resources/Foo.php';
+        $options = array(
+            array('someData'),
+            array('someMoreData'),
+        );
+
+        $resource = new Zend_Application_BootstrapTest_Resource_Foo($options);
+        $stored   = $resource->getOptions();
+        $this->assertSame($options, $stored);
+    }
 }
 
 if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_ResourceAbstractTest::main') {