This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -70,15 +70,17 @@ class Zend_Application
70
70
*
71
71
* @param string $environment
72
72
* @param string|array|Zend_Config $options String path to configuration file, or array/Zend_Config of configuration options
73
+ * @param bool $suppressNotFoundWarnings Should warnings be suppressed when a file is not found during autoloading?
73
74
* @throws Zend_Application_Exception When invalid options are provided
74
75
* @return void
75
76
*/
76
- public function __construct ($ environment , $ options = null )
77
+ public function __construct ($ environment , $ options = null , $ suppressNotFoundWarnings = null )
77
78
{
78
79
$ this ->_environment = (string ) $ environment ;
79
80
80
81
require_once 'Zend/Loader/Autoloader.php ' ;
81
82
$ this ->_autoloader = Zend_Loader_Autoloader::getInstance ();
83
+ $ this ->_autoloader ->suppressNotFoundWarnings ($ suppressNotFoundWarnings );
82
84
83
85
if (null !== $ options ) {
84
86
if (is_string ($ options )) {
Original file line number Diff line number Diff line change @@ -108,6 +108,33 @@ public function testConstructorShouldSetOptionsWhenProvided()
108
108
$ this ->assertEquals ($ options , $ application ->getOptions ());
109
109
}
110
110
111
+ /**
112
+ * @group GH-564
113
+ * @depends testConstructorInstantiatesAutoloader
114
+ */
115
+ public function testConstructorRespectsSuppressFileNotFoundWarningFlag ()
116
+ {
117
+ $ application = new Zend_Application ('testing ' );
118
+ $ this ->assertFalse ($ application ->getAutoloader ()->suppressNotFoundWarnings ()); //Default value
119
+
120
+ $ application = new Zend_Application ('testing ' , null , $ suppressNotFoundWarnings = true );
121
+ $ this ->assertTrue ($ application ->getAutoloader ()->suppressNotFoundWarnings ());
122
+
123
+ $ application = new Zend_Application ('testing ' , null , $ suppressNotFoundWarnings = false );
124
+ $ this ->assertFalse ($ application ->getAutoloader ()->suppressNotFoundWarnings ());
125
+
126
+ $ options = array (
127
+ 'foo ' => 'bar ' ,
128
+ 'bar ' => 'baz ' ,
129
+ );
130
+
131
+ $ application = new Zend_Application ('testing ' , $ options , $ suppressNotFoundWarnings = true );
132
+ $ this ->assertTrue ($ application ->getAutoloader ()->suppressNotFoundWarnings ());
133
+
134
+ $ application = new Zend_Application ('testing ' , $ options , $ suppressNotFoundWarnings = false );
135
+ $ this ->assertFalse ($ application ->getAutoloader ()->suppressNotFoundWarnings ());
136
+ }
137
+
111
138
public function testHasOptionShouldReturnFalseWhenOptionNotPresent ()
112
139
{
113
140
$ this ->assertFalse ($ this ->application ->hasOption ('foo ' ));
You can’t perform that action at this time.
0 commit comments