comparison vendor/symfony/phpunit-bridge/Tests/DeprecationErrorHandler/default.phpt @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 1fec387a4317
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 --TEST--
2 Test DeprecationErrorHandler in default mode
3 --FILE--
4 <?php
5
6 putenv('SYMFONY_DEPRECATIONS_HELPER');
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 eval(<<<'EOPHP'
22 namespace PHPUnit\Util;
23
24 class Test
25 {
26 public static function getGroups()
27 {
28 return array();
29 }
30 }
31 EOPHP
32 );
33
34 class PHPUnit_Util_Test
35 {
36 public static function getGroups()
37 {
38 return array();
39 }
40 }
41
42 class FooTestCase
43 {
44 public function testLegacyFoo()
45 {
46 @trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
47 trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
48 trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
49 }
50
51 public function testNonLegacyBar()
52 {
53 @trigger_error('silenced bar deprecation', E_USER_DEPRECATED);
54 trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED);
55 }
56 }
57
58 $foo = new FooTestCase();
59 $foo->testLegacyFoo();
60 $foo->testNonLegacyBar();
61
62 ?>
63 --EXPECTF--
64 Unsilenced deprecation notices (3)
65
66 unsilenced foo deprecation: 2x
67 2x in FooTestCase::testLegacyFoo
68
69 unsilenced bar deprecation: 1x
70 1x in FooTestCase::testNonLegacyBar
71
72 Remaining deprecation notices (1)
73
74 silenced bar deprecation: 1x
75 1x in FooTestCase::testNonLegacyBar
76
77 Legacy deprecation notices (1)
78
79 Other deprecation notices (1)
80
81 root deprecation: 1x
82