Ver código fonte

ZF-6536: error suppression should be disabled by default in the autoloader

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15507 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 anos atrás
pai
commit
d7d2ddbd05

+ 1 - 1
library/Zend/Loader/Autoloader.php

@@ -75,7 +75,7 @@ class Zend_Loader_Autoloader
     /**
      * @var bool Whether or not to suppress file not found warnings
      */
-    protected $_suppressNotFoundWarnings = true;
+    protected $_suppressNotFoundWarnings = false;
 
     /**
      * Retrieve singleton instance

+ 8 - 10
tests/Zend/Loader/AutoloaderTest.php

@@ -192,15 +192,18 @@ class Zend_Loader_AutoloaderTest extends PHPUnit_Framework_TestCase
         $this->autoloader->unregisterNamespace($o);
     }
 
-    public function testAutoloaderSuppressNotFoundWarningsFlagShouldBeEnabledByDefault()
+    /**
+     * @group ZF-6536
+     */
+    public function testWarningSuppressionShouldBeDisabledByDefault()
     {
-        $this->assertTrue($this->autoloader->suppressNotFoundWarnings());
+        $this->assertFalse($this->autoloader->suppressNotFoundWarnings());
     }
 
     public function testAutoloaderSuppressNotFoundWarningsFlagShouldBeMutable()
     {
-        $this->autoloader->suppressNotFoundWarnings(false);
-        $this->assertFalse($this->autoloader->suppressNotFoundWarnings());
+        $this->autoloader->suppressNotFoundWarnings(true);
+        $this->assertTrue($this->autoloader->suppressNotFoundWarnings());
     }
 
     public function testFallbackAutoloaderFlagShouldBeOffByDefault()
@@ -344,12 +347,7 @@ class Zend_Loader_AutoloaderTest extends PHPUnit_Framework_TestCase
         $this->autoloader->suppressNotFoundWarnings(false);
         $this->autoloader->registerNamespace('ZendLoaderAutoloader');
         set_error_handler(array($this, 'handleErrors'));
-        try {
-            Zend_Loader_Autoloader::autoload('ZendLoaderAutoloader_Bar');
-            $this->fail('No exception raised when error suppression was disabled');
-        } catch (Zend_Exception $e) {
-            $this->assertContains('not found', $e->getMessage());
-        }
+        $this->assertFalse(Zend_Loader_Autoloader::autoload('ZendLoaderAutoloader_Bar'));
         restore_error_handler();
         $this->assertNotNull($this->error);
     }