From 0919c951a0d5bdc889236a9b8f7723140c6c1379 Mon Sep 17 00:00:00 2001 From: Sergey Emelyanov Date: Thu, 15 Feb 2024 18:35:18 +0300 Subject: [PATCH] Added symfony 6 support --- .github/workflows/php.yml | 3 ++- .gitignore | 1 + composer.json | 18 +++++++++--------- tests/Adapters/Redis/RedisConnectionTest.php | 2 +- .../MetricBundle/AbstractMetricBundleTest.php | 3 ++- tests/MetricBundle/Fixtures/TestKernel.php | 10 +++++----- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index dfc88ec..4e54fd8 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -20,7 +20,8 @@ jobs: - { os: ubuntu-latest, php: 7.3, experimental: false} - { os: ubuntu-latest, php: 7.4, experimental: false} - { os: ubuntu-latest, php: 8.0, experimental: false} - - { os: ubuntu-latest, php: 8.1, experimental: true} + - { os: ubuntu-latest, php: 8.1, experimental: false } + - { os: ubuntu-latest, php: 8.2, packages: symfony/symfony=6.*, experimental: true } - { os: ubuntu-latest, php: 7.1, packages: symfony/symfony=3.4.*, experimental: false} - { os: ubuntu-latest, php: 7.1, packages: symfony/symfony=4.0.*, experimental: false} - { os: ubuntu-latest, php: 8.0, packages: symfony/symfony=4.*, experimental: false} diff --git a/.gitignore b/.gitignore index e621940..dafd436 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ vendor/ build/ target/ .php_cs.cache +.idea/ \ No newline at end of file diff --git a/composer.json b/composer.json index 95f6176..0f4550a 100644 --- a/composer.json +++ b/composer.json @@ -21,16 +21,16 @@ "doctrine/dbal": "^2.3", "doctrine/doctrine-bundle": "~1.5 || ^2.0", "doctrine/orm": "~2.4", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0 || ^10.0", "predis/predis": "^1.1", - "symfony/browser-kit": "~2.8 || ~3.0 || ~4.0 || ^5.0", - "symfony/config": "~2.8 || ~3.0 || ~4.0 || ^5.0", - "symfony/dependency-injection": "~2.8 || ~3.0 || ~4.0 || ^5.0", - "symfony/framework-bundle": "~2.8 || ~3.0 || ~4.0 || ^5.0", - "symfony/http-kernel": "~2.8 || ~3.0 || ~4.0 || ^5.0", - "symfony/routing": "~2.8 || ~3.0 || ~4.0 || ^5.0", - "symfony/stopwatch": "~2.8 || ~3.0 || ~4.0 || ^5.0", - "symfony/yaml": "~2.8 || ~3.0 || ~4.0 || ^5.0" + "symfony/browser-kit": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0", + "symfony/config": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0", + "symfony/dependency-injection": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0", + "symfony/framework-bundle": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0", + "symfony/http-kernel": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0", + "symfony/routing": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0", + "symfony/stopwatch": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0", + "symfony/yaml": "~2.8 || ~3.0 || ~4.0 || ^5.0 || ^6.0" }, "autoload": { "psr-4": { diff --git a/tests/Adapters/Redis/RedisConnectionTest.php b/tests/Adapters/Redis/RedisConnectionTest.php index de8b5b0..9fb08db 100644 --- a/tests/Adapters/Redis/RedisConnectionTest.php +++ b/tests/Adapters/Redis/RedisConnectionTest.php @@ -51,7 +51,7 @@ public function testAdjustMetric(): void ->expects($this->once()) ->method('hincrbyfloat') ->with(self::METRICS_KEY, $expectedField, $value) - ->willReturn(17); + ->willReturn(17.0); $actual = $this->redisConnection->adjustMetric('test', $value, ['severity' => 'high']); self::assertEquals(17, $actual); diff --git a/tests/MetricBundle/AbstractMetricBundleTest.php b/tests/MetricBundle/AbstractMetricBundleTest.php index 286bf57..eab3868 100644 --- a/tests/MetricBundle/AbstractMetricBundleTest.php +++ b/tests/MetricBundle/AbstractMetricBundleTest.php @@ -10,6 +10,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\HttpKernel\KernelInterface; abstract class AbstractMetricBundleTest extends WebTestCase { @@ -33,7 +34,7 @@ protected static function getEntityManager(): EntityManagerInterface return static::$em; } - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { $kernel = parent::createKernel($options); $fs = new Filesystem(); diff --git a/tests/MetricBundle/Fixtures/TestKernel.php b/tests/MetricBundle/Fixtures/TestKernel.php index d2ad56d..39e14cf 100644 --- a/tests/MetricBundle/Fixtures/TestKernel.php +++ b/tests/MetricBundle/Fixtures/TestKernel.php @@ -11,7 +11,7 @@ final class TestKernel extends Kernel { /** {@inheritdoc} */ - public function registerBundles() + public function registerBundles(): iterable { return [ new FrameworkBundle(), @@ -27,22 +27,22 @@ public function registerContainerConfiguration(LoaderInterface $loader) $loader->load(__DIR__ . '/config.yml'); } - public function getRootDir() + public function getRootDir(): string { return __DIR__; } - public function getProjectDir() + public function getProjectDir(): string { return __DIR__; } - public function getCacheDir() + public function getCacheDir(): string { return __DIR__ . '/../../../build/cache'; } - public function getLogDir() + public function getLogDir(): string { return __DIR__ . '/../../../build/logs'; }