-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 4.4: [PhpUnitBridge] Fix qualification of deprecations triggered by the debug class loader Improve return phpdoc for Normalizer Use a partial buffer in SymfonyStyle Fix console closing tag Fix typo in comment [VarDumper] fix casting resources turned into objects on PHP 8
- Loading branch information
Showing
9 changed files
with
114 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
vendor/ | ||
composer.lock | ||
phpunit.xml | ||
Tests/DeprecationErrorHandler/fake_vendor/symfony/error-handler/DebugClassLoader.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Tests/DeprecationErrorHandler/debug_class_loader_autoload.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--TEST-- | ||
Test that a deprecation from the DebugClassLoader on a vendor class autoload triggered by an app class is considered indirect. | ||
--FILE-- | ||
<?php | ||
|
||
$k = 'SYMFONY_DEPRECATIONS_HELPER'; | ||
putenv($k.'='.$_SERVER[$k] = $_ENV[$k] = 'max[total]=0'); | ||
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(<<<'EOPHP' | ||
namespace PHPUnit\Util; | ||
class Test | ||
{ | ||
public static function getGroups() | ||
{ | ||
return array(); | ||
} | ||
} | ||
EOPHP | ||
); | ||
require __DIR__.'/fake_vendor/autoload.php'; | ||
|
||
// We need the real DebugClassLoader FQCN but in a vendor path. | ||
if (!file_exists($errorHandlerRootDir = __DIR__.'/../../../../Component/ErrorHandler')) { | ||
if (!file_exists($errorHandlerRootDir = __DIR__.'/../../vendor/symfony/error-handler')) { | ||
die('Could not find the ErrorHandler component root directory.'); | ||
} | ||
} | ||
|
||
file_put_contents($fakeDebugClassLoadPath = __DIR__.'/fake_vendor/symfony/error-handler/DebugClassLoader.php', file_get_contents($errorHandlerRootDir.'/DebugClassLoader.php')); | ||
require $fakeDebugClassLoadPath; | ||
|
||
\Symfony\Component\ErrorHandler\DebugClassLoader::enable(); | ||
new \App\Services\BarService(); | ||
|
||
?> | ||
--EXPECTF-- | ||
Remaining indirect deprecation notices (1) | ||
|
||
1x: The "acme\lib\ExtendsDeprecatedClassFromOtherVendor" class extends "fcy\lib\DeprecatedClass" that is deprecated. | ||
1x in BarService::__construct from App\Services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Services; | ||
|
||
use acme\lib\ExtendsDeprecatedClassFromOtherVendor; | ||
|
||
final class BarService | ||
{ | ||
public function __construct() | ||
{ | ||
ExtendsDeprecatedClassFromOtherVendor::FOO; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Tests/DeprecationErrorHandler/fake_vendor/acme/lib/ExtendsDeprecatedClassFromOtherVendor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace acme\lib; | ||
|
||
use fcy\lib\DeprecatedClass; | ||
|
||
final class ExtendsDeprecatedClassFromOtherVendor extends DeprecatedClass | ||
{ | ||
public const FOO = 'bar'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Tests/DeprecationErrorHandler/fake_vendor/fcy/lib/DeprecatedClass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace fcy\lib; | ||
|
||
/** | ||
* @deprecated | ||
*/ | ||
class DeprecatedClass | ||
{ | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters