File tree 5 files changed +66
-4
lines changed
src/Symfony/Bridge/PhpUnit
Tests/DeprecationErrorHandler
5 files changed +66
-4
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,13 @@ private function getConfiguration()
216
216
return $ this ->configuration ;
217
217
}
218
218
if (false === $ mode = $ this ->mode ) {
219
- $ mode = getenv ('SYMFONY_DEPRECATIONS_HELPER ' );
219
+ if (isset ($ _SERVER ['SYMFONY_DEPRECATIONS_HELPER ' ])) {
220
+ $ mode = $ _SERVER ['SYMFONY_DEPRECATIONS_HELPER ' ];
221
+ } elseif (isset ($ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ])) {
222
+ $ mode = $ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ];
223
+ } else {
224
+ $ mode = getenv ('SYMFONY_DEPRECATIONS_HELPER ' );
225
+ }
220
226
}
221
227
if ('strict ' === $ mode ) {
222
228
return $ this ->configuration = Configuration::inStrictMode ();
Original file line number Diff line number Diff line change 1
1
--TEST--
2
- Test DeprecationErrorHandler in weak mode
2
+ Test DeprecationErrorHandler in disabled mode
3
3
--FILE--
4
4
<?php
5
5
6
- putenv ( 'SYMFONY_DEPRECATIONS_HELPER= disabled ' ) ;
6
+ $ _SERVER [ 'SYMFONY_DEPRECATIONS_HELPER ' ] = ' disabled ' ;
7
7
putenv ('ANSICON ' );
8
8
putenv ('ConEmuANSI ' );
9
9
putenv ('TERM ' );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test DeprecationErrorHandler in disabled mode (via putenv)
3
+ --FILE--
4
+ <?php
5
+
6
+ $ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ] = 'disabled ' ;
7
+ putenv ('ANSICON ' );
8
+ putenv ('ConEmuANSI ' );
9
+ putenv ('TERM ' );
10
+
11
+ $ vendor = __DIR__ ;
12
+ while (!file_exists ($ vendor .'/vendor ' )) {
13
+ $ vendor = dirname ($ vendor );
14
+ }
15
+ define ('PHPUNIT_COMPOSER_INSTALL ' , $ vendor .'/vendor/autoload.php ' );
16
+ require PHPUNIT_COMPOSER_INSTALL ;
17
+ require_once __DIR__ .'/../../bootstrap.php ' ;
18
+
19
+ echo (int ) set_error_handler ('var_dump ' );
20
+ echo (int ) class_exists ('Symfony\Bridge\PhpUnit\DeprecationErrorHandler ' , false );
21
+
22
+ ?>
23
+ --EXPECTF--
24
+ 00
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test DeprecationErrorHandler in disabled mode (via putenv)
3
+ --FILE--
4
+ <?php
5
+
6
+ putenv ('SYMFONY_DEPRECATIONS_HELPER=disabled ' );
7
+ putenv ('ANSICON ' );
8
+ putenv ('ConEmuANSI ' );
9
+ putenv ('TERM ' );
10
+
11
+ $ vendor = __DIR__ ;
12
+ while (!file_exists ($ vendor .'/vendor ' )) {
13
+ $ vendor = dirname ($ vendor );
14
+ }
15
+ define ('PHPUNIT_COMPOSER_INSTALL ' , $ vendor .'/vendor/autoload.php ' );
16
+ require PHPUNIT_COMPOSER_INSTALL ;
17
+ require_once __DIR__ .'/../../bootstrap.php ' ;
18
+
19
+ echo (int ) set_error_handler ('var_dump ' );
20
+ echo (int ) class_exists ('Symfony\Bridge\PhpUnit\DeprecationErrorHandler ' , false );
21
+
22
+ ?>
23
+ --EXPECTF--
24
+ 00
Original file line number Diff line number Diff line change 35
35
}
36
36
}
37
37
38
+ if (isset ($ _SERVER ['SYMFONY_DEPRECATIONS_HELPER ' ]) && 'disabled ' === $ _SERVER ['SYMFONY_DEPRECATIONS_HELPER ' ]) {
39
+ return ;
40
+ }
41
+
42
+ if (isset ($ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ]) && 'disabled ' === $ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ]) {
43
+ return ;
44
+ }
45
+
38
46
if ('disabled ' !== getenv ('SYMFONY_DEPRECATIONS_HELPER ' )) {
39
- DeprecationErrorHandler::register (getenv ( ' SYMFONY_DEPRECATIONS_HELPER ' ) );
47
+ DeprecationErrorHandler::register (false );
40
48
}
You can’t perform that action at this time.
0 commit comments