|
| 1 | +--TEST-- |
| 2 | +Test deprecation types with trigger_deprecation |
| 3 | +--FILE-- |
| 4 | +<?php |
| 5 | + |
| 6 | +$k = 'SYMFONY_DEPRECATIONS_HELPER'; |
| 7 | +putenv($k.'='.$_SERVER[$k] = $_ENV[$k] = 'max[self]=0'); |
| 8 | +putenv('ANSICON'); |
| 9 | +putenv('ConEmuANSI'); |
| 10 | +putenv('TERM'); |
| 11 | + |
| 12 | +$vendor = __DIR__; |
| 13 | +while (!file_exists($vendor.'/vendor')) { |
| 14 | + $vendor = dirname($vendor); |
| 15 | +} |
| 16 | +define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php'); |
| 17 | +require PHPUNIT_COMPOSER_INSTALL; |
| 18 | +require_once __DIR__.'/../../bootstrap.php'; |
| 19 | + |
| 20 | +eval(<<<'EOPHP' |
| 21 | +namespace PHPUnit\Util; |
| 22 | +
|
| 23 | +class Test |
| 24 | +{ |
| 25 | + public static function getGroups() |
| 26 | + { |
| 27 | + return array(); |
| 28 | + } |
| 29 | +} |
| 30 | +EOPHP |
| 31 | +); |
| 32 | + |
| 33 | +require __DIR__.'/fake_vendor/autoload.php'; |
| 34 | + |
| 35 | +(new \App\Services\AppService())->selfDeprecation(true); |
| 36 | +(new \App\Services\AppService())->directDeprecation(true); |
| 37 | +(new \App\Services\AppService())->indirectDeprecation(true); |
| 38 | +trigger_deprecation('foo/bar', '2.0', 'func is deprecated, use new instead.'); |
| 39 | +?> |
| 40 | +--EXPECTF-- |
| 41 | +Remaining self deprecation notices (1) |
| 42 | + |
| 43 | + 1x: Since App 3.0: selfDeprecation is deprecated, use selfDeprecation_new instead. |
| 44 | + 1x in AppService::selfDeprecation from App\Services |
| 45 | + |
| 46 | +Remaining direct deprecation notices (1) |
| 47 | + |
| 48 | + 1x: Since acme/lib 3.0: deprecatedApi is deprecated, use deprecatedApi_new instead. |
| 49 | + 1x in AppService::directDeprecation from App\Services |
| 50 | + |
| 51 | +Remaining indirect deprecation notices (1) |
| 52 | + |
| 53 | + 1x: Since bar/lib 3.0: deprecatedApi is deprecated, use deprecatedApi_new instead. |
| 54 | + 1x in AppService::indirectDeprecation from App\Services |
| 55 | + |
| 56 | +Other deprecation notices (1) |
| 57 | + |
| 58 | + 1x: Since foo/bar 2.0: func is deprecated, use new instead. |
0 commit comments