Skip to content

Commit 9a8f28a

Browse files
authored
To PHPUnit 10 (#466)
To PHPUnit 10
1 parent 7ce7695 commit 9a8f28a

File tree

133 files changed

+796
-1952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+796
-1952
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"blackfire/php-sdk": "^2.0",
122122
"ekino/phpstan-banned-code": "^1.0",
123123
"infection/infection": "^0.27",
124-
"matthiasnoback/symfony-config-test": "^4.3.0 || ^5.0.0",
124+
"matthiasnoback/symfony-config-test": "^5.0.0",
125125
"nyholm/psr7": "^1.5",
126126
"php-http/mock-client": "^1.5",
127127
"php-parallel-lint/php-parallel-lint": "^1.3",
@@ -131,7 +131,7 @@
131131
"phpstan/phpstan-deprecation-rules": "^1.0",
132132
"phpstan/phpstan-phpunit": "^1.1",
133133
"phpstan/phpstan-strict-rules": "^1.4",
134-
"phpunit/phpunit": "^9.5.23",
134+
"phpunit/phpunit": "^10.1",
135135
"qossmic/deptrac-shim": "^1.0",
136136
"rector/rector": "^0.17",
137137
"roave/security-advisories": "dev-latest",

ecs.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,8 @@
9494
__DIR__ . '/performance',
9595
__DIR__ . '/src',
9696
__DIR__ . '/tests',
97+
__DIR__ . '/ecs.php',
98+
__DIR__ . '/rector.php',
99+
__DIR__ . '/monorepo-builder.php',
97100
]);
98101
};

monorepo-builder.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateReplaceReleaseWorker;
1414

1515
return static function (MBConfig $mbConfig): void {
16-
$mbConfig->packageDirectories([
17-
__DIR__ . '/src',
18-
__DIR__ . '/packs',
19-
]);
16+
$mbConfig->packageDirectories([__DIR__ . '/src', __DIR__ . '/packs']);
2017

2118
$mbConfig->workers([
2219
UpdateReplaceReleaseWorker::class,

phpunit.xml.dist

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
backupGlobals="false"
5-
backupStaticAttributes="false"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
115
bootstrap="vendor/autoload.php"
12-
beStrictAboutTestsThatDoNotTestAnything="false"
136
colors="true"
14-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
157
>
16-
<coverage>
17-
<include>
18-
<directory suffix=".php">./src</directory>
19-
</include>
20-
</coverage>
8+
<coverage/>
219
<testsuites>
2210
<testsuite name="Test Suite">
2311
<directory>./tests/</directory>
2412
</testsuite>
2513
</testsuites>
2614
<php>
27-
<ini name="error_reporting" value="-1"/>
15+
<ini name="display_errors" value="1"/>
16+
<ini name="error_reporting" value="32765"/>
2817
<ini name="intl.default_locale" value="en"/>
2918
<ini name="intl.error_level" value="0"/>
3019
<ini name="memory_limit" value="-1"/>
3120
<server name="KERNEL_CLASS" value="Jose\Tests\Bundle\JoseFramework\AppKernel"/>
32-
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
33-
<server name="SYMFONY_PHPUNIT_VERSION" value="8"/>
3421
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
3522
</php>
36-
<listeners>
37-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
38-
</listeners>
23+
<source>
24+
<include>
25+
<directory suffix=".php">./src</directory>
26+
</include>
27+
</source>
3928
</phpunit>

rector.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

33
declare(strict_types=1);
4-
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
5-
use Rector\PHPUnit\Rector\Class_\AnnotationWithValueToAttributeRector;
64

75
use Rector\Config\RectorConfig;
6+
87
use Rector\Core\ValueObject\PhpVersion;
98
use Rector\Doctrine\Set\DoctrineSetList;
9+
use Rector\PHPUnit\Rector\Class_\PreferPHPUnitThisCallRector;
1010
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
1111
use Rector\PHPUnit\Set\PHPUnitSetList;
1212
use Rector\Set\ValueObject\LevelSetList;
@@ -18,18 +18,20 @@
1818
$config->import(SetList::DEAD_CODE);
1919
$config->import(LevelSetList::UP_TO_PHP_81);
2020
$config->import(SymfonyLevelSetList::UP_TO_SYMFONY_54);
21-
$config->import(SymfonySetList::SYMFONY_CODE_QUALITY);
21+
$config->import(SymfonySetList::SYMFONY_50_TYPES);
2222
$config->import(SymfonySetList::SYMFONY_52_VALIDATOR_ATTRIBUTES);
23+
$config->import(SymfonySetList::SYMFONY_CODE_QUALITY);
2324
$config->import(SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION);
2425
$config->import(SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES);
2526
$config->import(DoctrineSetList::DOCTRINE_CODE_QUALITY);
2627
$config->import(DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES);
2728
$config->import(PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD);
28-
$config->import(PHPUnitLevelSetList::UP_TO_PHPUNIT_90);
29+
$config->import(PHPUnitLevelSetList::UP_TO_PHPUNIT_100);
2930
$config->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
3031
$config->import(PHPUnitSetList::PHPUNIT_EXCEPTION);
31-
$config->import(PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER);
3232
$config->import(PHPUnitSetList::REMOVE_MOCKS);
33+
$config->import(PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD);
34+
$config->import(PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES);
3335
$config->paths([
3436
__DIR__ . '/ecs.php',
3537
__DIR__ . '/rector.php',
@@ -39,12 +41,12 @@
3941
__DIR__ . '/tests',
4042
]);
4143
$config->skip([
42-
AnnotationToAttributeRector::class => __DIR__ . '/tests',
43-
AnnotationWithValueToAttributeRector::class => __DIR__ . '/tests',
4444
__DIR__ . '/src/Component/Core/JWKSet.php',
4545
__DIR__ . '/src/Bundle/JoseFramework/DependencyInjection/Source/KeyManagement/JWKSource.php',
4646
__DIR__ . '/src/Bundle/JoseFramework/DependencyInjection/Source/KeyManagement/JWKSetSource.php',
4747
]);
48+
$config->services()
49+
->remove(PreferPHPUnitThisCallRector::class);
4850
$config->phpVersion(PhpVersion::PHP_81);
4951
$config->parallel();
5052
$config->importNames();

tests/Bundle/JoseFramework/Functional/Checker/ClaimCheckerTest.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Jose\Bundle\JoseFramework\Services\ClaimCheckerManagerFactory as ClaimCheckerManagerFactoryService;
88
use Jose\Component\Checker\ClaimCheckerManagerFactory;
9+
use PHPUnit\Framework\Attributes\Test;
910
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1011
use Symfony\Component\DependencyInjection\ContainerInterface;
1112

@@ -21,9 +22,7 @@ protected function setUp(): void
2122
}
2223
}
2324

24-
/**
25-
* @test
26-
*/
25+
#[Test]
2726
public static function theClaimCheckerManagerFactoryIsAvailable(): void
2827
{
2928
static::ensureKernelShutdown();
@@ -33,9 +32,7 @@ public static function theClaimCheckerManagerFactoryIsAvailable(): void
3332
static::assertTrue($container->has(ClaimCheckerManagerFactoryService::class));
3433
}
3534

36-
/**
37-
* @test
38-
*/
35+
#[Test]
3936
public static function theClaimCheckerManagerFactoryCanCreateAClaimCheckerManager(): void
4037
{
4138
static::ensureKernelShutdown();
@@ -49,9 +46,7 @@ public static function theClaimCheckerManagerFactoryCanCreateAClaimCheckerManage
4946
$claimCheckerManagerFactory->create($aliases);
5047
}
5148

52-
/**
53-
* @test
54-
*/
49+
#[Test]
5550
public static function aClaimCheckerCanBeDefinedUsingTheConfigurationFile(): void
5651
{
5752
static::ensureKernelShutdown();
@@ -61,9 +56,7 @@ public static function aClaimCheckerCanBeDefinedUsingTheConfigurationFile(): voi
6156
static::assertTrue($container->has('jose.claim_checker.checker1'));
6257
}
6358

64-
/**
65-
* @test
66-
*/
59+
#[Test]
6760
public static function aClaimCheckerCanBeDefinedFromAnotherBundleUsingTheHelper(): void
6861
{
6962
static::ensureKernelShutdown();

tests/Bundle/JoseFramework/Functional/Checker/ConfigurationTest.php

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Jose\Bundle\JoseFramework\DependencyInjection\Source\Core\CoreSource;
1010
use Jose\Component\Checker\ClaimCheckerManagerFactory;
1111
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
12+
use PHPUnit\Framework\Attributes\Test;
1213
use PHPUnit\Framework\TestCase;
1314

1415
/**
@@ -25,17 +26,13 @@ protected function setUp(): void
2526
}
2627
}
2728

28-
/**
29-
* @test
30-
*/
29+
#[Test]
3130
public function theConfigurationIsValidIfNoConfigurationIsSet(): void
3231
{
3332
$this->assertConfigurationIsValid([]);
3433
}
3534

36-
/**
37-
* @test
38-
*/
35+
#[Test]
3936
public function theConfigurationIsValidIfConfigurationIsFalse(): void
4037
{
4138
$this->assertConfigurationIsValid([
@@ -45,9 +42,7 @@ public function theConfigurationIsValidIfConfigurationIsFalse(): void
4542
]);
4643
}
4744

48-
/**
49-
* @test
50-
*/
45+
#[Test]
5146
public function theConfigurationIsValidIfConfigurationIsEmpty(): void
5247
{
5348
$this->assertConfigurationIsValid([
@@ -57,9 +52,7 @@ public function theConfigurationIsValidIfConfigurationIsEmpty(): void
5752
]);
5853
}
5954

60-
/**
61-
* @test
62-
*/
55+
#[Test]
6356
public function theConfigurationIsValidIfNoHeaderOrClaimCheckerIsSet(): void
6457
{
6558
$this->assertConfigurationIsValid([
@@ -72,9 +65,7 @@ public function theConfigurationIsValidIfNoHeaderOrClaimCheckerIsSet(): void
7265
]);
7366
}
7467

75-
/**
76-
* @test
77-
*/
68+
#[Test]
7869
public function theHeadersForAHeaderCheckerShouldBeSet(): void
7970
{
8071
$this->assertConfigurationIsInvalid(
@@ -93,9 +84,7 @@ public function theHeadersForAHeaderCheckerShouldBeSet(): void
9384
);
9485
}
9586

96-
/**
97-
* @test
98-
*/
87+
#[Test]
9988
public function aHeaderCheckerMayContainNoChecker(): void
10089
{
10190
$this->assertConfigurationIsValid(
@@ -114,9 +103,7 @@ public function aHeaderCheckerMayContainNoChecker(): void
114103
);
115104
}
116105

117-
/**
118-
* @test
119-
*/
106+
#[Test]
120107
public function theClaimsForAClaimCheckerShouldBeSet(): void
121108
{
122109
$this->assertConfigurationIsInvalid(
@@ -135,9 +122,7 @@ public function theClaimsForAClaimCheckerShouldBeSet(): void
135122
);
136123
}
137124

138-
/**
139-
* @test
140-
*/
125+
#[Test]
141126
public function aClaimCheckerMayContainNoChecker(): void
142127
{
143128
$this->assertConfigurationIsValid(

tests/Bundle/JoseFramework/Functional/Checker/HeaderCheckerTest.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Jose\Bundle\JoseFramework\Services\HeaderCheckerManagerFactory as HeaderCheckerManagerFactoryService;
88
use Jose\Component\Checker\HeaderCheckerManagerFactory;
9+
use PHPUnit\Framework\Attributes\Test;
910
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1011
use Symfony\Component\DependencyInjection\ContainerInterface;
1112

@@ -21,9 +22,7 @@ protected function setUp(): void
2122
}
2223
}
2324

24-
/**
25-
* @test
26-
*/
25+
#[Test]
2726
public static function theHeaderCheckerManagerFactoryIsAvailable(): void
2827
{
2928
static::ensureKernelShutdown();
@@ -33,9 +32,7 @@ public static function theHeaderCheckerManagerFactoryIsAvailable(): void
3332
static::assertTrue($container->has(HeaderCheckerManagerFactoryService::class));
3433
}
3534

36-
/**
37-
* @test
38-
*/
35+
#[Test]
3936
public static function theHeaderCheckerManagerFactoryCanCreateAHeaderCheckerManager(): void
4037
{
4138
static::ensureKernelShutdown();
@@ -49,9 +46,7 @@ public static function theHeaderCheckerManagerFactoryCanCreateAHeaderCheckerMana
4946
$headerCheckerManagerFactory->create($aliases);
5047
}
5148

52-
/**
53-
* @test
54-
*/
49+
#[Test]
5550
public static function aHeaderCheckerCanBeDefinedUsingTheConfigurationFile(): void
5651
{
5752
static::ensureKernelShutdown();
@@ -61,9 +56,7 @@ public static function aHeaderCheckerCanBeDefinedUsingTheConfigurationFile(): vo
6156
static::assertTrue($container->has('jose.header_checker.checker1'));
6257
}
6358

64-
/**
65-
* @test
66-
*/
59+
#[Test]
6760
public static function aHeaderCheckerCanBeDefinedFromAnotherBundleUsingTheHelper(): void
6861
{
6962
static::ensureKernelShutdown();

tests/Bundle/JoseFramework/Functional/Console/ConsoleTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Jose\Tests\Bundle\JoseFramework\Functional\Console;
66

77
use Jose\Component\Console\EcKeyGeneratorCommand;
8+
use PHPUnit\Framework\Attributes\Test;
89
use Symfony\Bundle\FrameworkBundle\Console\Application;
910
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1011

@@ -20,9 +21,7 @@ protected function setUp(): void
2021
}
2122
}
2223

23-
/**
24-
* @test
25-
*/
24+
#[Test]
2625
public static function allCommandsAreAvailable(): void
2726
{
2827
$expectedCommands = [

0 commit comments

Comments
 (0)