Update
This commit is contained in:
parent
a37785b391
commit
33458b2ca3
9915 changed files with 1247019 additions and 0 deletions
|
|
@ -0,0 +1,87 @@
|
|||
--TEST--
|
||||
Test DeprecationErrorHandler in default mode
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
putenv('SYMFONY_DEPRECATIONS_HELPER');
|
||||
putenv('ANSICON');
|
||||
putenv('ConEmuANSI');
|
||||
putenv('TERM');
|
||||
|
||||
$vendor = __DIR__;
|
||||
while (!file_exists($vendor.'/vendor')) {
|
||||
$vendor = dirname($vendor);
|
||||
}
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
require_once __DIR__.'/../../bootstrap.php';
|
||||
|
||||
@trigger_error('root deprecation', E_USER_DEPRECATED);
|
||||
|
||||
eval(<<<'EOPHP'
|
||||
namespace PHPUnit\Util;
|
||||
|
||||
class Test
|
||||
{
|
||||
public static function getGroups()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
EOPHP
|
||||
);
|
||||
|
||||
class PHPUnit_Util_Test
|
||||
{
|
||||
public static function getGroups()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
class FooTestCase
|
||||
{
|
||||
public function testLegacyFoo()
|
||||
{
|
||||
@trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
public function testNonLegacyBar()
|
||||
{
|
||||
@trigger_error('silenced bar deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new FooTestCase();
|
||||
$foo->testLegacyFoo();
|
||||
$foo->testNonLegacyBar();
|
||||
|
||||
register_shutdown_function(function () {
|
||||
exit('I get precedence over any exit statements inside the deprecation error handler.');
|
||||
});
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Unsilenced deprecation notices (3)
|
||||
|
||||
2x: unsilenced foo deprecation
|
||||
2x in FooTestCase::testLegacyFoo
|
||||
|
||||
1x: unsilenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Remaining deprecation notices (1)
|
||||
|
||||
1x: silenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Legacy deprecation notices (1)
|
||||
|
||||
Other deprecation notices (1)
|
||||
|
||||
1x: root deprecation
|
||||
|
||||
I get precedence over any exit statements inside the deprecation error handler.
|
||||
Binary file not shown.
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
@trigger_error('I come from… afar! :D', E_USER_DEPRECATED);
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
--TEST--
|
||||
Test DeprecationErrorHandler in weak mode
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
|
||||
putenv('ANSICON');
|
||||
putenv('ConEmuANSI');
|
||||
putenv('TERM');
|
||||
|
||||
$vendor = __DIR__;
|
||||
while (!file_exists($vendor.'/vendor')) {
|
||||
$vendor = dirname($vendor);
|
||||
}
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
require_once __DIR__.'/../../bootstrap.php';
|
||||
|
||||
echo (int) set_error_handler('var_dump');
|
||||
echo (int) class_exists('Symfony\Bridge\PhpUnit\DeprecationErrorHandler', false);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
00
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
eval(<<<'EOPHP'
|
||||
namespace PHPUnit\Util;
|
||||
|
||||
class Test
|
||||
{
|
||||
public static function getGroups()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
EOPHP
|
||||
);
|
||||
|
||||
@trigger_error('root deprecation', E_USER_DEPRECATED);
|
||||
|
||||
class FooTestCase
|
||||
{
|
||||
public function testLegacyFoo()
|
||||
{
|
||||
@trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
|
||||
@trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
public function testNonLegacyBar()
|
||||
{
|
||||
@trigger_error('silenced bar deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new FooTestCase();
|
||||
$foo->testLegacyFoo();
|
||||
$foo->testNonLegacyBar();
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__.'/composer/autoload_real.php';
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
class ComposerAutoloaderInitFake
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"just here": "for the detection"}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
|
||||
$phar = new Phar(__DIR__.DIRECTORY_SEPARATOR.'deprecation.phar', 0, 'deprecation.phar');
|
||||
$phar->buildFromDirectory(__DIR__.DIRECTORY_SEPARATOR.'deprecation');
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--TEST--
|
||||
Test DeprecationErrorHandler in weak mode
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
putenv('SYMFONY_DEPRECATIONS_HELPER=/foo/');
|
||||
putenv('ANSICON');
|
||||
putenv('ConEmuANSI');
|
||||
putenv('TERM');
|
||||
|
||||
$vendor = __DIR__;
|
||||
while (!file_exists($vendor.'/vendor')) {
|
||||
$vendor = dirname($vendor);
|
||||
}
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
require_once __DIR__.'/../../bootstrap.php';
|
||||
|
||||
@trigger_error('root deprecation', E_USER_DEPRECATED);
|
||||
|
||||
class FooTestCase
|
||||
{
|
||||
public function testLegacyFoo()
|
||||
{
|
||||
@trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new FooTestCase();
|
||||
$foo->testLegacyFoo();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Legacy deprecation triggered by FooTestCase::testLegacyFoo:
|
||||
silenced foo deprecation
|
||||
Stack trace:
|
||||
#%A(%d): FooTestCase->testLegacyFoo()
|
||||
#%d {main}
|
||||
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
--TEST--
|
||||
Test DeprecationErrorHandler in default mode
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
putenv('SYMFONY_DEPRECATIONS_HELPER');
|
||||
putenv('ANSICON');
|
||||
putenv('ConEmuANSI');
|
||||
putenv('TERM');
|
||||
|
||||
$vendor = __DIR__;
|
||||
while (!file_exists($vendor.'/vendor')) {
|
||||
$vendor = dirname($vendor);
|
||||
}
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
require_once __DIR__.'/../../bootstrap.php';
|
||||
|
||||
@trigger_error('root deprecation', E_USER_DEPRECATED);
|
||||
|
||||
eval(<<<'EOPHP'
|
||||
namespace PHPUnit\Util;
|
||||
|
||||
class Test
|
||||
{
|
||||
public static function getGroups()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
EOPHP
|
||||
);
|
||||
|
||||
class PHPUnit_Util_Test
|
||||
{
|
||||
public static function getGroups()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
class FooTestCase
|
||||
{
|
||||
public function testLegacyFoo()
|
||||
{
|
||||
@trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
public function testNonLegacyBar()
|
||||
{
|
||||
@trigger_error('silenced bar deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new FooTestCase();
|
||||
$foo->testLegacyFoo();
|
||||
$foo->testNonLegacyBar();
|
||||
|
||||
register_shutdown_function(function () {
|
||||
@trigger_error('root deprecation during shutdown', E_USER_DEPRECATED);
|
||||
});
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Unsilenced deprecation notices (3)
|
||||
|
||||
2x: unsilenced foo deprecation
|
||||
2x in FooTestCase::testLegacyFoo
|
||||
|
||||
1x: unsilenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Remaining deprecation notices (1)
|
||||
|
||||
1x: silenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Legacy deprecation notices (1)
|
||||
|
||||
Other deprecation notices (1)
|
||||
|
||||
1x: root deprecation
|
||||
|
||||
Shutdown-time deprecations:
|
||||
|
||||
Other deprecation notices (1)
|
||||
|
||||
1x: root deprecation during shutdown
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
--TEST--
|
||||
Test DeprecationErrorHandler in weak mode
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
putenv('SYMFONY_DEPRECATIONS_HELPER=weak');
|
||||
putenv('ANSICON');
|
||||
putenv('ConEmuANSI');
|
||||
putenv('TERM');
|
||||
|
||||
$vendor = __DIR__;
|
||||
while (!file_exists($vendor.'/vendor')) {
|
||||
$vendor = dirname($vendor);
|
||||
}
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
require_once __DIR__.'/../../bootstrap.php';
|
||||
|
||||
@trigger_error('root deprecation', E_USER_DEPRECATED);
|
||||
|
||||
class FooTestCase
|
||||
{
|
||||
public function testLegacyFoo()
|
||||
{
|
||||
@trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new FooTestCase();
|
||||
$foo->testLegacyFoo();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Unsilenced deprecation notices (1)
|
||||
|
||||
Legacy deprecation notices (1)
|
||||
|
||||
Other deprecation notices (1)
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
--TEST--
|
||||
Test DeprecationErrorHandler in weak vendors mode on eval()'d deprecation
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
putenv('SYMFONY_DEPRECATIONS_HELPER=weak_vendors');
|
||||
putenv('ANSICON');
|
||||
putenv('ConEmuANSI');
|
||||
putenv('TERM');
|
||||
|
||||
$vendor = __DIR__;
|
||||
while (!file_exists($vendor.'/vendor')) {
|
||||
$vendor = dirname($vendor);
|
||||
}
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
require_once __DIR__.'/../../bootstrap.php';
|
||||
eval("@trigger_error('who knows where I come from?', E_USER_DEPRECATED);");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Other deprecation notices (1)
|
||||
|
||||
1x: who knows where I come from?
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
--TEST--
|
||||
Test DeprecationErrorHandler in weak vendors mode on a non vendor file
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
putenv('SYMFONY_DEPRECATIONS_HELPER=weak_vendors');
|
||||
putenv('ANSICON');
|
||||
putenv('ConEmuANSI');
|
||||
putenv('TERM');
|
||||
|
||||
$vendor = __DIR__;
|
||||
while (!file_exists($vendor.'/vendor')) {
|
||||
$vendor = dirname($vendor);
|
||||
}
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
require_once __DIR__.'/../../bootstrap.php';
|
||||
|
||||
@trigger_error('root deprecation', E_USER_DEPRECATED);
|
||||
|
||||
eval(<<<'EOPHP'
|
||||
namespace PHPUnit\Util;
|
||||
|
||||
class Test
|
||||
{
|
||||
public static function getGroups()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
EOPHP
|
||||
);
|
||||
|
||||
class FooTestCase
|
||||
{
|
||||
public function testLegacyFoo()
|
||||
{
|
||||
@trigger_error('silenced foo deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
public function testNonLegacyBar()
|
||||
{
|
||||
@trigger_error('silenced bar deprecation', E_USER_DEPRECATED);
|
||||
trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new FooTestCase();
|
||||
$foo->testLegacyFoo();
|
||||
$foo->testNonLegacyBar();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Unsilenced deprecation notices (3)
|
||||
|
||||
2x: unsilenced foo deprecation
|
||||
2x in FooTestCase::testLegacyFoo
|
||||
|
||||
1x: unsilenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Remaining deprecation notices (1)
|
||||
|
||||
1x: silenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Legacy deprecation notices (1)
|
||||
|
||||
Other deprecation notices (1)
|
||||
|
||||
1x: root deprecation
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
--TEST--
|
||||
Test DeprecationErrorHandler in weak vendors mode on eval()'d deprecation
|
||||
The phar can be regenerated by running php src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/generate_phar.php
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
putenv('SYMFONY_DEPRECATIONS_HELPER=weak_vendors');
|
||||
putenv('ANSICON');
|
||||
putenv('ConEmuANSI');
|
||||
putenv('TERM');
|
||||
|
||||
$vendor = __DIR__;
|
||||
while (!file_exists($vendor.'/vendor')) {
|
||||
$vendor = dirname($vendor);
|
||||
}
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
require_once __DIR__.'/../../bootstrap.php';
|
||||
\Phar::loadPhar(__DIR__.'/deprecation.phar', 'deprecation.phar');
|
||||
include 'phar://deprecation.phar/deprecation.php';
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Other deprecation notices (1)
|
||||
|
||||
1x: I come from… afar! :D
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
--TEST--
|
||||
Test DeprecationErrorHandler in weak vendors mode on vendor file
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
putenv('SYMFONY_DEPRECATIONS_HELPER=weak_vendors');
|
||||
putenv('ANSICON');
|
||||
putenv('ConEmuANSI');
|
||||
putenv('TERM');
|
||||
|
||||
$vendor = __DIR__;
|
||||
while (!file_exists($vendor.'/vendor')) {
|
||||
$vendor = dirname($vendor);
|
||||
}
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
require_once __DIR__.'/../../bootstrap.php';
|
||||
require __DIR__.'/fake_vendor/autoload.php';
|
||||
require __DIR__.'/fake_vendor/acme/lib/deprecation_riddled.php';
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Unsilenced deprecation notices (3)
|
||||
|
||||
2x: unsilenced foo deprecation
|
||||
2x in FooTestCase::testLegacyFoo
|
||||
|
||||
1x: unsilenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Remaining vendor deprecation notices (1)
|
||||
|
||||
1x: silenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Legacy deprecation notices (2)
|
||||
|
||||
Other deprecation notices (1)
|
||||
|
||||
1x: root deprecation
|
||||
Loading…
Add table
Add a link
Reference in a new issue