From 10ab00aa21d163a10d9f85d4b4d8a89292d2a847 Mon Sep 17 00:00:00 2001 From: Jeffrey Wong Date: Fri, 16 Feb 2024 21:10:38 -0800 Subject: [PATCH] support symfony 6 --- Framework/Test/ServiceTestCase.php | 8 ++--- Tests/TestKernel.php | 7 ++-- composer.json | 9 ++--- phpunit.xml.dist | 56 ++++++++++++++---------------- 4 files changed, 38 insertions(+), 42 deletions(-) diff --git a/Framework/Test/ServiceTestCase.php b/Framework/Test/ServiceTestCase.php index 0702a34..7c753a9 100644 --- a/Framework/Test/ServiceTestCase.php +++ b/Framework/Test/ServiceTestCase.php @@ -94,7 +94,7 @@ static private function getPhpUnitCliConfigArgument() */ static protected function getKernelClass() { - $dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : static::getPhpUnitXmlDir(); + $dir = $_SERVER['KERNEL_DIR'] ?? static::getPhpUnitXmlDir(); $finder = new Finder(); $finder->name('*Kernel.php')->depth(0)->in($dir); @@ -123,15 +123,15 @@ static protected function getKernelClass() * * @return HttpKernelInterface A HttpKernelInterface instance */ - static protected function createKernel(array $options = array()) + static protected function createKernel(array $options = []) { if (null === static::$class) { static::$class = static::getKernelClass(); } return new static::$class( - isset($options['environment']) ? $options['environment'] : 'test', - isset($options['debug']) ? $options['debug'] : true + $options['environment'] ?? 'test', + $options['debug'] ?? true ); } diff --git a/Tests/TestKernel.php b/Tests/TestKernel.php index 1ae9ddf..feac284 100644 --- a/Tests/TestKernel.php +++ b/Tests/TestKernel.php @@ -11,17 +11,16 @@ public function getRootDir() { return __DIR__.'/Resources'; } - public function registerBundles() + public function registerBundles(): iterable { - return array( - ); + return []; } public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load(__DIR__.'/Resources/config/config_test.yml'); if (class_exists('Symfony\Component\Asset\Package')) { $loader->load(function (ContainerBuilder $container) { - $container->loadFromExtension('framework', array('assets' => array())); + $container->loadFromExtension('framework', ['assets' => []]); }); } } diff --git a/composer.json b/composer.json index 1a14f30..84aca20 100644 --- a/composer.json +++ b/composer.json @@ -21,13 +21,14 @@ ], "require": { "php": ">=7.4", - "symfony/http-kernel": "^4.4.12|^5.0", + "symfony/http-kernel": "^4.4.12|^5.0|^6.0", "phpunit/phpunit": "^8.5.23|^9.0" }, "require-dev": { - "symfony/config": "^4.4.12|^5.0", - "symfony/dependency-injection": "^4.4.12|^5.0", - "symfony/yaml": "^4.4.12|^5.0" + "symfony/config": "^4.4.12|^5.0|^6.0", + "symfony/dependency-injection": "^4.4.12|^5.0|^6.0", + "symfony/yaml": "^4.4.12|^5.0|^6.0", + "rector/rector": "^0.19.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e9230a1..ece7173 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,6 @@ - - - - - - - - - - ./Tests - - - - - - - - - - ./ - - ./Tests - ./vendor - ./Resources - - - + bootstrap="Tests/autoload.php" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> + + + ./ + + + ./Tests + ./vendor + ./Resources + + + + + + + + + ./Tests + + + + +