Skip to content

Commit 901ff09

Browse files
authored
Merge pull request #717 from chimeraphp/renovate/phpunit-phpunit-10.x
Update dependency phpunit/phpunit to v10
2 parents a6501e1 + 796487e commit 901ff09

10 files changed

+294
-390
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
/phpcs.xml
44
/.phpcs.cache
55
/infection.log
6-
/.phpunit.result.cache
6+
/.phpunit.cache
77
/build

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"phpstan/phpstan-deprecation-rules": "^1.0",
3131
"phpstan/phpstan-phpunit": "^1.1",
3232
"phpstan/phpstan-strict-rules": "^1.4",
33-
"phpunit/phpunit": "^9.5"
33+
"phpunit/phpunit": "^10.0.16"
3434
},
3535
"conflict": {
3636
"lcobucci/di-builder": "7.2.0"

composer.lock

Lines changed: 225 additions & 283 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpunit.xml.dist

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
55
colors="true"
6-
verbose="true"
76
beStrictAboutOutputDuringTests="true"
8-
beStrictAboutTodoAnnotatedTests="true"
97
beStrictAboutChangesToGlobalState="true"
10-
beStrictAboutCoversAnnotation="true"
11-
beStrictAboutResourceUsageDuringSmallTests="true"
12-
forceCoversAnnotation="true"
138
failOnRisky="true"
149
failOnWarning="true"
1510
executionOrder="random"
11+
cacheDirectory=".phpunit.cache"
12+
requireCoverageMetadata="true"
13+
beStrictAboutCoverageMetadata="true"
1614
>
17-
<coverage processUncoveredFiles="true">
15+
<coverage>
1816
<include>
1917
<directory>src</directory>
2018
</include>

tests/Functional/ApplicationRegistrationTest.php

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace Chimera\DependencyInjection\Tests\Functional;
55

6+
use Chimera\DependencyInjection as Services;
67
use Chimera\DependencyInjection\Tests\Functional\App\CreateThing;
78
use Chimera\DependencyInjection\Tests\Functional\App\CreateThingHandler;
89
use Chimera\DependencyInjection\Tests\Functional\App\FetchThing;
@@ -32,6 +33,7 @@
3233
use Mezzio\Router\Middleware\MethodNotAllowedMiddleware;
3334
use Mezzio\Router\Route;
3435
use Mezzio\Router\RouteCollector;
36+
use PHPUnit\Framework\Attributes as PHPUnit;
3537
use Psr\Http\Server\MiddlewareInterface;
3638
use ReflectionProperty;
3739
use SplQueue;
@@ -41,23 +43,21 @@
4143
use function assert;
4244
use function iterator_to_array;
4345

44-
/**
45-
* @covers \Chimera\DependencyInjection\Mapping\ExpandTags
46-
* @covers \Chimera\DependencyInjection\Mapping\Package
47-
* @covers \Chimera\DependencyInjection\MessageCreator\JmsSerializer\Package
48-
* @covers \Chimera\DependencyInjection\Routing\ErrorHandling\Package
49-
* @covers \Chimera\DependencyInjection\Routing\ErrorHandling\RegisterDefaultComponents
50-
* @covers \Chimera\DependencyInjection\Routing\Mezzio\Package
51-
* @covers \Chimera\DependencyInjection\Routing\Mezzio\RegisterServices
52-
* @covers \Chimera\DependencyInjection\ServiceBus\Tactician\Package
53-
* @covers \Chimera\DependencyInjection\ServiceBus\Tactician\RegisterServices
54-
* @covers \Chimera\DependencyInjection\RegisterApplication
55-
* @covers \Chimera\DependencyInjection\RegisterDefaultComponents
56-
* @covers \Chimera\DependencyInjection\ValidateApplicationComponents
57-
*/
46+
#[PHPUnit\CoversClass(Services\Mapping\ExpandTags::class)]
47+
#[PHPUnit\CoversClass(Services\Mapping\Package::class)]
48+
#[PHPUnit\CoversClass(Services\MessageCreator\JmsSerializer\Package::class)]
49+
#[PHPUnit\CoversClass(Services\Routing\ErrorHandling\Package::class)]
50+
#[PHPUnit\CoversClass(Services\Routing\ErrorHandling\RegisterDefaultComponents::class)]
51+
#[PHPUnit\CoversClass(Services\Routing\Mezzio\Package::class)]
52+
#[PHPUnit\CoversClass(Services\Routing\Mezzio\RegisterServices::class)]
53+
#[PHPUnit\CoversClass(Services\ServiceBus\Tactician\Package::class)]
54+
#[PHPUnit\CoversClass(Services\ServiceBus\Tactician\RegisterServices::class)]
55+
#[PHPUnit\CoversClass(Services\RegisterApplication::class)]
56+
#[PHPUnit\CoversClass(Services\RegisterDefaultComponents::class)]
57+
#[PHPUnit\CoversClass(Services\ValidateApplicationComponents::class)]
5858
final class ApplicationRegistrationTest extends ApplicationTestCase
5959
{
60-
/** @test */
60+
#[PHPUnit\Test]
6161
public function applicationMustBeCorrectlyRegistered(): void
6262
{
6363
$container = $this->createContainer();
@@ -66,7 +66,7 @@ public function applicationMustBeCorrectlyRegistered(): void
6666
self::assertInstanceOf(Application::class, $container->get('sample-app.http'));
6767
}
6868

69-
/** @test */
69+
#[PHPUnit\Test]
7070
public function routesMustBeProperlyDefined(): void
7171
{
7272
$container = $this->createContainer();
@@ -106,7 +106,7 @@ private static function assertRouteRegistered(
106106
self::assertSame($expectedName, $match[0]->getName());
107107
}
108108

109-
/** @test */
109+
#[PHPUnit\Test]
110110
public function httpMiddlewaresMustBeProperlyDefined(): void
111111
{
112112
$container = $this->createContainer();
@@ -135,7 +135,6 @@ public function httpMiddlewaresMustBeProperlyDefined(): void
135135
}
136136

137137
$property = new ReflectionProperty(MiddlewarePipe::class, 'pipeline');
138-
$property->setAccessible(true);
139138

140139
$result = $container->get('sample-app.http.middleware_pipeline');
141140
assert($result instanceof MiddlewarePipe);
@@ -148,7 +147,7 @@ public function httpMiddlewaresMustBeProperlyDefined(): void
148147
self::assertSame(iterator_to_array($expectedPipeline), iterator_to_array($resultingPipeline));
149148
}
150149

151-
/** @test */
150+
#[PHPUnit\Test]
152151
public function serviceBusesMustExist(): void
153152
{
154153
$container = $this->createContainer();
@@ -157,7 +156,7 @@ public function serviceBusesMustExist(): void
157156
self::assertInstanceOf(ServiceBus::class, $container->get('sample-app.query_bus'));
158157
}
159158

160-
/** @test */
159+
#[PHPUnit\Test]
161160
public function commandBusHandlersMustBeProperlyDefined(): void
162161
{
163162
$container = $this->createContainer();
@@ -169,7 +168,7 @@ public function commandBusHandlersMustBeProperlyDefined(): void
169168
self::assertInstanceOf(RemoveThingHandler::class, $locator->getHandlerForCommand(RemoveThing::class));
170169
}
171170

172-
/** @test */
171+
#[PHPUnit\Test]
173172
public function commandBusMiddlewareMustBeProperlyDefined(): void
174173
{
175174
$container = $this->createContainer();
@@ -187,7 +186,7 @@ public function commandBusMiddlewareMustBeProperlyDefined(): void
187186
self::assertEquals(new CommandBus($middlewareList), $bus); // @phpstan-ignore-line
188187
}
189188

190-
/** @test */
189+
#[PHPUnit\Test]
191190
public function queryBusHandlersMustBeProperlyDefined(): void
192191
{
193192
$container = $this->createContainer();
@@ -199,7 +198,7 @@ public function queryBusHandlersMustBeProperlyDefined(): void
199198
self::assertInstanceOf(ListThingsHandler::class, $locator->getHandlerForCommand(ListThings::class));
200199
}
201200

202-
/** @test */
201+
#[PHPUnit\Test]
203202
public function queryBusMiddlewareMustBeProperlyDefined(): void
204203
{
205204
$container = $this->createContainer();

tests/Functional/ApplicationRunTest.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
namespace Chimera\DependencyInjection\Tests\Functional;
55

6+
use Chimera\DependencyInjection as Services;
67
use Chimera\Routing\Application;
78
use Laminas\Diactoros\ServerRequestFactory;
89
use Laminas\Diactoros\StreamFactory;
10+
use PHPUnit\Framework\Attributes as PHPUnit;
911
use Psr\Http\Message\ResponseInterface;
1012
use Psr\Http\Message\ServerRequestInterface;
1113
use Ramsey\Uuid\Uuid;
@@ -16,31 +18,27 @@
1618

1719
use const JSON_THROW_ON_ERROR;
1820

19-
/**
20-
* @covers \Chimera\DependencyInjection\Mapping\ExpandTags
21-
* @covers \Chimera\DependencyInjection\Mapping\Package
22-
* @covers \Chimera\DependencyInjection\MessageCreator\JmsSerializer\Package
23-
* @covers \Chimera\DependencyInjection\Routing\ErrorHandling\Package
24-
* @covers \Chimera\DependencyInjection\Routing\ErrorHandling\RegisterDefaultComponents
25-
* @covers \Chimera\DependencyInjection\Routing\Mezzio\Package
26-
* @covers \Chimera\DependencyInjection\Routing\Mezzio\RegisterServices
27-
* @covers \Chimera\DependencyInjection\ServiceBus\Tactician\Package
28-
* @covers \Chimera\DependencyInjection\ServiceBus\Tactician\RegisterServices
29-
* @covers \Chimera\DependencyInjection\RegisterApplication
30-
* @covers \Chimera\DependencyInjection\RegisterDefaultComponents
31-
* @covers \Chimera\DependencyInjection\ValidateApplicationComponents
32-
*/
21+
#[PHPUnit\CoversClass(Services\Mapping\ExpandTags::class)]
22+
#[PHPUnit\CoversClass(Services\Mapping\Package::class)]
23+
#[PHPUnit\CoversClass(Services\MessageCreator\JmsSerializer\Package::class)]
24+
#[PHPUnit\CoversClass(Services\Routing\ErrorHandling\Package::class)]
25+
#[PHPUnit\CoversClass(Services\Routing\ErrorHandling\RegisterDefaultComponents::class)]
26+
#[PHPUnit\CoversClass(Services\Routing\Mezzio\Package::class)]
27+
#[PHPUnit\CoversClass(Services\Routing\Mezzio\RegisterServices::class)]
28+
#[PHPUnit\CoversClass(Services\ServiceBus\Tactician\Package::class)]
29+
#[PHPUnit\CoversClass(Services\ServiceBus\Tactician\RegisterServices::class)]
30+
#[PHPUnit\CoversClass(Services\RegisterApplication::class)]
31+
#[PHPUnit\CoversClass(Services\RegisterDefaultComponents::class)]
32+
#[PHPUnit\CoversClass(Services\ValidateApplicationComponents::class)]
3333
final class ApplicationRunTest extends ApplicationTestCase
3434
{
3535
private const UUID_PATTERN = '[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[1-5]{1}[0-9A-Fa-f]{3}-'
3636
. '[ABab89]{1}[0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}';
3737

3838
private const ITEM_ENDPOINT = '/^\/things\/' . self::UUID_PATTERN . '$/';
3939

40-
/**
41-
* @test
42-
* @dataProvider possibleRequests
43-
*/
40+
#[PHPUnit\Test]
41+
#[PHPUnit\DataProvider('possibleRequests')]
4442
public function correctResponseShouldBeProvided(ServerRequestInterface $request, callable $verifyResponse): void
4543
{
4644
$container = $this->createContainer();
@@ -52,7 +50,7 @@ public function correctResponseShouldBeProvided(ServerRequestInterface $request,
5250
}
5351

5452
/** @return iterable<string, array{0: ServerRequestInterface, 1: callable}> */
55-
public function possibleRequests(): iterable
53+
public static function possibleRequests(): iterable
5654
{
5755
$factory = new ServerRequestFactory();
5856
$streamFactory = new StreamFactory();

tests/Functional/ApplicationTestCase.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Mezzio\Router\Middleware\DispatchMiddleware;
1818
use Mezzio\Router\Middleware\ImplicitOptionsMiddleware;
1919
use Mezzio\Router\Middleware\MethodNotAllowedMiddleware;
20+
use PHPUnit\Framework\Attributes as PHPUnit;
2021
use PHPUnit\Framework\TestCase;
2122
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
2223
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
@@ -59,10 +60,8 @@ abstract class ApplicationTestCase extends TestCase
5960
'sample-app.query_bus.decorated_bus.handler.locator',
6061
];
6162

62-
/**
63-
* @beforeClass
64-
* @afterClass
65-
*/
63+
#[PHPUnit\BeforeClass]
64+
#[PHPUnit\AfterClass]
6665
final public static function cleanUpContainer(): void
6766
{
6867
exec('rm -rf ' . __DIR__ . '/App/dump');

tests/Unit/RegisterApplicationTest.php

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,26 @@
55

66
use Chimera\DependencyInjection as Services;
77
use Chimera\DependencyInjection\RegisterApplication;
8+
use PHPUnit\Framework\Attributes as PHPUnit;
89
use PHPUnit\Framework\TestCase;
910
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
1011

1112
use function dirname;
1213
use function iterator_to_array;
1314

14-
/**
15-
* @covers \Chimera\DependencyInjection\Mapping\Package
16-
* @covers \Chimera\DependencyInjection\MessageCreator\JmsSerializer\Package
17-
* @covers \Chimera\DependencyInjection\Routing\ErrorHandling\Package
18-
* @covers \Chimera\DependencyInjection\Routing\ErrorHandling\RegisterDefaultComponents
19-
* @covers \Chimera\DependencyInjection\Routing\Mezzio\Package
20-
* @covers \Chimera\DependencyInjection\Routing\Mezzio\RegisterServices
21-
* @covers \Chimera\DependencyInjection\ServiceBus\Tactician\Package
22-
* @covers \Chimera\DependencyInjection\ServiceBus\Tactician\RegisterServices
23-
* @covers \Chimera\DependencyInjection\ValidateApplicationComponents
24-
* @coversDefaultClass \Chimera\DependencyInjection\RegisterApplication
25-
*/
15+
#[PHPUnit\CoversClass(Services\Mapping\Package::class)]
16+
#[PHPUnit\CoversClass(Services\MessageCreator\JmsSerializer\Package::class)]
17+
#[PHPUnit\CoversClass(Services\Routing\ErrorHandling\Package::class)]
18+
#[PHPUnit\CoversClass(Services\Routing\ErrorHandling\RegisterDefaultComponents::class)]
19+
#[PHPUnit\CoversClass(Services\Routing\Mezzio\Package::class)]
20+
#[PHPUnit\CoversClass(Services\Routing\Mezzio\RegisterServices::class)]
21+
#[PHPUnit\CoversClass(Services\ServiceBus\Tactician\Package::class)]
22+
#[PHPUnit\CoversClass(Services\ServiceBus\Tactician\RegisterServices::class)]
23+
#[PHPUnit\CoversClass(Services\ValidateApplicationComponents::class)]
24+
#[PHPUnit\CoversClass(RegisterApplication::class)]
2625
final class RegisterApplicationTest extends TestCase
2726
{
28-
/**
29-
* @test
30-
*
31-
* @covers ::__construct()
32-
* @covers ::getFiles()
33-
* @covers ::filterPackages()
34-
*/
27+
#[PHPUnit\Test]
3528
public function getFilesShouldYieldFilesFromAllRelatedAndInstalledPackages(): void
3629
{
3730
$package = new RegisterApplication('testing');
@@ -46,13 +39,7 @@ public function getFilesShouldYieldFilesFromAllRelatedAndInstalledPackages(): vo
4639
self::assertContains(dirname(__DIR__, 2) . '/config/serialization-jms.xml', $files);
4740
}
4841

49-
/**
50-
* @test
51-
*
52-
* @covers ::__construct()
53-
* @covers ::getCompilerPasses()
54-
* @covers ::filterPackages()
55-
*/
42+
#[PHPUnit\Test]
5643
public function getCompilerPassesShouldYieldPassesFromAllRelatedAndInstalledPackages(): void
5744
{
5845
$package = new RegisterApplication('testing');

tests/Unit/Routing/Mezzio/RegisterServicesTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,15 @@
66
use Chimera\DependencyInjection\Routing\Mezzio\RegisterServices;
77
use Chimera\DependencyInjection\Tags;
88
use InvalidArgumentException;
9+
use PHPUnit\Framework\Attributes as PHPUnit;
910
use PHPUnit\Framework\TestCase;
1011
use Symfony\Component\DependencyInjection\ContainerBuilder;
1112
use Symfony\Component\DependencyInjection\Definition;
1213

13-
/** @coversDefaultClass \Chimera\DependencyInjection\Routing\Mezzio\RegisterServices */
14+
#[PHPUnit\CoversClass(RegisterServices::class)]
1415
final class RegisterServicesTest extends TestCase
1516
{
16-
/**
17-
* @test
18-
*
19-
* @covers ::__construct
20-
* @covers ::process
21-
* @covers ::extractRoutes
22-
*/
17+
#[PHPUnit\Test]
2318
public function exceptionShouldBeRaisedWhenTryingToRegisterDuplicatedRoutes(): void
2419
{
2520
$service1 = new Definition();

tests/Unit/ValidateApplicationComponentsTest.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,16 @@
55

66
use Chimera\DependencyInjection\ValidateApplicationComponents;
77
use Chimera\Routing\Application;
8+
use PHPUnit\Framework\Attributes as PHPUnit;
89
use PHPUnit\Framework\TestCase;
910
use RuntimeException;
1011
use Symfony\Component\DependencyInjection\ContainerBuilder;
1112
use Symfony\Component\DependencyInjection\Definition;
1213

13-
/** @coversDefaultClass \Chimera\DependencyInjection\ValidateApplicationComponents */
14+
#[PHPUnit\CoversClass(ValidateApplicationComponents::class)]
1415
final class ValidateApplicationComponentsTest extends TestCase
1516
{
16-
/**
17-
* @test
18-
*
19-
* @covers ::__construct
20-
* @covers ::process
21-
*/
17+
#[PHPUnit\Test]
2218
public function exceptionShouldBeRaisedWhenDefinitionIsNotPublic(): void
2319
{
2420
$builder = new ContainerBuilder();
@@ -32,12 +28,7 @@ public function exceptionShouldBeRaisedWhenDefinitionIsNotPublic(): void
3228
$pass->process($builder);
3329
}
3430

35-
/**
36-
* @test
37-
*
38-
* @covers ::__construct
39-
* @covers ::process
40-
*/
31+
#[PHPUnit\Test]
4132
public function exceptionShouldBeRaisedWhenLegacyAliasIsNotPublic(): void
4233
{
4334
$builder = new ContainerBuilder();
@@ -51,12 +42,7 @@ public function exceptionShouldBeRaisedWhenLegacyAliasIsNotPublic(): void
5142
$pass->process($builder);
5243
}
5344

54-
/**
55-
* @test
56-
*
57-
* @covers ::__construct
58-
* @covers ::process
59-
*/
45+
#[PHPUnit\Test]
6046
public function noExceptionShouldBeRaisedWhenExpectedServicesArePublic(): void
6147
{
6248
$builder = new ContainerBuilder();

0 commit comments

Comments
 (0)