Skip to content

Commit 9852658

Browse files
authored
Upgrade PHPUnit to v11 (#88)
1 parent 310d686 commit 9852658

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed

.github/workflows/tests.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ jobs:
5555
ini-values: zend.exception_ignore_args=false
5656
tools: flex
5757

58+
- name: Downgrade PHPUnit for PHP 8.1
59+
if: matrix.php == '8.1'
60+
run: |
61+
composer require --dev --no-update phpunit/phpunit:^10.5
62+
sed -i 's/failOnPhpunitDeprecation="true"//g' phpunit.dist.xml
63+
5864
- name: Install Dependencies
5965
uses: ramsey/composer-install@v3
6066
with:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
},
4848
"require-dev": {
4949
"doctrine/common": "^3.2",
50-
"phpunit/phpunit": "^10.5",
50+
"phpunit/phpunit": "^11.5",
5151
"symfony/cache": "^5.4 || ^6.4 || ^7.0",
5252
"symfony/doctrine-messenger": "^5.4 || ^6.4 || ^7.0",
5353
"symfony/expression-language": "^5.4 || ^6.4 || ^7.0",

phpunit.dist.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
beStrictAboutOutputDuringTests="true"
55
beStrictAboutTestsThatDoNotTestAnything="true"
66
bootstrap="vendor/autoload.php"
77
cacheDirectory=".phpunit.cache"
88
colors="true"
9+
failOnEmptyTestSuite="true"
10+
failOnIncomplete="true"
11+
failOnNotice="true"
12+
failOnPhpunitDeprecation="true"
913
failOnRisky="true"
1014
failOnWarning="true"
1115
>

tests/Application/ConfigurationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public static function setUpBeforeClass(): void
3636
self::initializeApplication(['test_case' => 'TestApplication']);
3737

3838
self::$configuration = self::getContainer()->get('sofascore.purgatory.configuration_loader')->load();
39+
40+
self::ensureKernelShutdown();
3941
}
4042

4143
public static function tearDownAfterClass(): void

tests/Functional/TestKernel.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Symfony\Component\DependencyInjection\ContainerBuilder;
1212
use Symfony\Component\DependencyInjection\Definition;
1313
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
14+
use Symfony\Component\ErrorHandler\ErrorHandler;
1415
use Symfony\Component\HttpKernel\Kernel;
1516

1617
final class TestKernel extends Kernel
@@ -64,6 +65,15 @@ public function registerBundles(): iterable
6465
yield new PurgatoryBundle();
6566
}
6667

68+
public function shutdown(): void
69+
{
70+
$handler = set_exception_handler('var_dump');
71+
restore_exception_handler();
72+
if (\is_array($handler) && $handler[0] instanceof ErrorHandler) {
73+
restore_exception_handler();
74+
}
75+
}
76+
6777
public function registerContainerConfiguration(LoaderInterface $loader): void
6878
{
6979
$loader->load(function (ContainerBuilder $container) use ($loader) {

tests/Test/InteractsWithPurgatoryTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Sofascore\PurgatoryBundle\Tests\Test;
66

7-
use PHPUnit\Framework\Attributes\CoversClass;
87
use PHPUnit\Framework\Attributes\DataProvider;
98
use PHPUnit\Framework\TestCase;
109
use Sofascore\PurgatoryBundle\Purger\AsyncPurger;
@@ -18,7 +17,6 @@
1817
use Symfony\Component\DependencyInjection\Container;
1918
use Symfony\Component\Messenger\MessageBusInterface;
2019

21-
#[CoversClass(InteractsWithPurgatory::class)]
2220
final class InteractsWithPurgatoryTest extends TestCase
2321
{
2422
#[DataProvider('provideTraitTestCases')]

0 commit comments

Comments
 (0)