Skip to content

Commit 44dd066

Browse files
Merge branch '3.0'
* 3.0: [Bridge\PhpUnit] Add Tests/DeprecationErrorHandler/regexp.phpt
2 parents d53874b + af648d6 commit 44dd066

File tree

1 file changed

+40
-0
lines changed
  • src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
--TEST--
2+
Test DeprecationErrorHandler in weak mode
3+
--FILE--
4+
<?php
5+
6+
putenv('SYMFONY_DEPRECATIONS_HELPER=/foo/');
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+
@trigger_error('root deprecation', E_USER_DEPRECATED);
20+
21+
class FooTestCase
22+
{
23+
public function testLegacyFoo()
24+
{
25+
@trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
26+
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
27+
}
28+
}
29+
30+
$foo = new FooTestCase();
31+
$foo->testLegacyFoo();
32+
33+
?>
34+
--EXPECTF--
35+
Legacy deprecation triggered by FooTestCase::testLegacyFoo:
36+
silenced foo deprecation
37+
Stack trace:
38+
#%A(%d): FooTestCase->testLegacyFoo()
39+
#%d {main}
40+

0 commit comments

Comments
 (0)