From b9ced6ba01c46e951a53d7d9034f4f89b0992fd2 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Fri, 4 Feb 2022 13:40:10 +0100 Subject: [PATCH] Allow Symfony 6 --- .github/workflows/ci.yml | 10 +++++++++- composer.json | 14 +++++++------- .../Fixtures/php/cache_pool.php | 2 +- tests/Functional/FunctionalTestCase.php | 8 ++++++-- tests/Functional/app/AppKernel.php | 8 ++++---- 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e13006..94ba398 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,11 +25,16 @@ jobs: deps: lowest symfony: '^4.4' - # Test latest php with LTS versions + # Test LTS versions - php: 8.0 deps: stable symfony: '^4.4' + # Test latest php/Symfony + - php: 8.1 + deps: stable + symfony: '^6.0' + steps: - name: Checkout code uses: 'actions/checkout@v2' @@ -44,6 +49,9 @@ jobs: - name: Configure Symfony version run: 'echo SYMFONY_REQUIRE="${{ matrix.symfony }}" >> $GITHUB_ENV' + - name: Allow dev dependencies + run: 'composer config minimum-stability dev' + - name: Composer install uses: 'ramsey/composer-install@v1' with: diff --git a/composer.json b/composer.json index 1116b5c..17315c1 100644 --- a/composer.json +++ b/composer.json @@ -18,19 +18,19 @@ "require": { "php": ">=7.2.9", "ext-xml": "*", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/http-kernel": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", "symfony/security-acl": "^3.0", - "symfony/security-bundle": "^4.4|^5.0" + "symfony/security-bundle": "^4.4|^5.0|^6.0" }, "require-dev": { "doctrine/doctrine-bundle": "^1.6.12|^2.0", "doctrine/dbal": "^2.13.1|^3.1", "doctrine/orm": "^2.7.3", - "symfony/console": "^4.4|^5.0", - "symfony/framework-bundle": "^4.4|^5.0", - "symfony/phpunit-bridge": "^5.0", - "symfony/yaml": "^4.4|^5.0" + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^4.4|^5.0|^6.0", + "symfony/phpunit-bridge": "^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0" }, "suggest": { "doctrine/doctrine-bundle": "To use the default dbal configuration" diff --git a/tests/DependencyInjection/Fixtures/php/cache_pool.php b/tests/DependencyInjection/Fixtures/php/cache_pool.php index d639ea0..f8e3256 100644 --- a/tests/DependencyInjection/Fixtures/php/cache_pool.php +++ b/tests/DependencyInjection/Fixtures/php/cache_pool.php @@ -1,6 +1,6 @@ load('container1.php', $container); +$this->load('container1.php', 'php'); $container->loadFromExtension('acl', [ 'cache' => [ diff --git a/tests/Functional/FunctionalTestCase.php b/tests/Functional/FunctionalTestCase.php index 165704a..764a258 100644 --- a/tests/Functional/FunctionalTestCase.php +++ b/tests/Functional/FunctionalTestCase.php @@ -13,15 +13,19 @@ use Symfony\Bundle\AclBundle\Tests\Functional\app\AppKernel; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; +use Symfony\Component\HttpKernel\KernelInterface; class FunctionalTestCase extends KernelTestCase { - protected static function getKernelClass() + /** + * @return class-string + */ + protected static function getKernelClass(): string { return AppKernel::class; } - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { $class = self::getKernelClass(); diff --git a/tests/Functional/app/AppKernel.php b/tests/Functional/app/AppKernel.php index f9113bf..e9116e5 100644 --- a/tests/Functional/app/AppKernel.php +++ b/tests/Functional/app/AppKernel.php @@ -41,7 +41,7 @@ public function __construct($testCase, $rootConfig, $environment, $debug) parent::__construct($environment, $debug); } - public function registerBundles() + public function registerBundles(): iterable { if (!is_file($filename = $this->getRootDir().'/'.$this->testCase.'/bundles.php')) { throw new \RuntimeException(sprintf('The bundles file "%s" does not exist.', $filename)); @@ -55,12 +55,12 @@ public function getRootDir() return __DIR__; } - public function getCacheDir() + public function getCacheDir(): string { return sys_get_temp_dir().'/'.Kernel::VERSION.'/'.$this->testCase.'/cache/'.$this->environment; } - public function getLogDir() + public function getLogDir(): string { return sys_get_temp_dir().'/'.Kernel::VERSION.'/'.$this->testCase.'/logs'; } @@ -81,7 +81,7 @@ public function unserialize($str) $this->__construct($a[0], $a[1], $a[2], $a[3]); } - protected function getKernelParameters() + protected function getKernelParameters(): array { $parameters = parent::getKernelParameters(); $parameters['kernel.test_case'] = $this->testCase;