From 7da1c6b75a99ac72d3aa661c1aa417077f108044 Mon Sep 17 00:00:00 2001 From: Christopher Georg Date: Sat, 13 Apr 2024 11:13:41 +0200 Subject: [PATCH] feat: allow PHPUnit 10 --- Tests/Command/DumpCommandTest.php | 4 +++- Tests/DependencyInjection/MyBuilderCronosExtensionTest.php | 4 +++- composer.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Tests/Command/DumpCommandTest.php b/Tests/Command/DumpCommandTest.php index a40a467..dd93b5a 100644 --- a/Tests/Command/DumpCommandTest.php +++ b/Tests/Command/DumpCommandTest.php @@ -6,6 +6,7 @@ use MyBuilder\Bundle\CronosBundle\Command\ReplaceCommand; use MyBuilder\Bundle\CronosBundle\Tests\CronosTestCase; use MyBuilder\Bundle\CronosBundle\Tests\Fixtures\Command\TestCommand; +use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Tester\CommandTester; @@ -36,6 +37,7 @@ protected function tearDown(): void /** * @dataProvider environmentDumps */ + #[DataProvider('environmentDumps')] public function test_dump_should_be_as_expected(string $expectedOutput, array $input): void { $input = array_merge(['command' => $this->command->getName()], $input); @@ -46,7 +48,7 @@ public function test_dump_should_be_as_expected(string $expectedOutput, array $i static::assertEquals($expectedOutput, trim($commandTester->getDisplay())); } - public function environmentDumps(): array + public static function environmentDumps(): array { return [ [ diff --git a/Tests/DependencyInjection/MyBuilderCronosExtensionTest.php b/Tests/DependencyInjection/MyBuilderCronosExtensionTest.php index 1b7be1b..17cd6b1 100644 --- a/Tests/DependencyInjection/MyBuilderCronosExtensionTest.php +++ b/Tests/DependencyInjection/MyBuilderCronosExtensionTest.php @@ -3,6 +3,7 @@ namespace MyBuilder\Bundle\CronosBundle\Tests\DependencyInjection; use MyBuilder\Bundle\CronosBundle\DependencyInjection\MyBuilderCronosExtension; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -23,6 +24,7 @@ protected function setUp(): void /** * @dataProvider providerTestConfig */ + #[DataProvider('providerTestConfig')] public function test_config(array $expected, string $file): void { $this->loader->load($this->getConfig($file), $this->container); @@ -30,7 +32,7 @@ public function test_config(array $expected, string $file): void static::assertEquals($expected, $this->container->getParameter('mybuilder.cronos_bundle.exporter_config')); } - public function providerTestConfig(): array + public static function providerTestConfig(): array { if (method_exists(Kernel::class, 'getProjectDir')) { $pathToConsole = '%kernel.project_dir%/bin/console'; diff --git a/composer.json b/composer.json index f78aef0..c23f896 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "symfony/yaml": "^4.4.20 || ^5.4 || ^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.5.27" + "phpunit/phpunit": "^9.6.19 || ^10.5.17" }, "autoload": { "psr-4": { "MyBuilder\\Bundle\\CronosBundle\\": "" }