Skip to content

Commit ed90c68

Browse files
authored
Merge pull request #577 from chimeraphp/renovate/phpunit-phpunit-10.x
Update dependency phpunit/phpunit to v10
2 parents 575afbb + 1500ca1 commit ed90c68

File tree

11 files changed

+424
-549
lines changed

11 files changed

+424
-549
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
/phpstan.neon
55
/.phpcs.cache
66
/infection.log
7-
/.phpunit.result.cache
7+
/.phpunit.cache
88
/build

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
"ramsey/uuid": "^4.5"
1515
},
1616
"require-dev": {
17-
"infection/infection": "^0.26",
17+
"infection/infection": "^0.26.19",
1818
"lcobucci/coding-standard": "^9.0",
1919
"phpstan/extension-installer": "^1.2",
2020
"phpstan/phpstan": "^1.8",
2121
"phpstan/phpstan-deprecation-rules": "^1.0",
2222
"phpstan/phpstan-phpunit": "^1.1",
2323
"phpstan/phpstan-strict-rules": "^1.4",
24-
"phpunit/phpunit": "^9.5"
24+
"phpunit/phpunit": "^10.0.16"
2525
},
2626
"autoload": {
2727
"psr-4": {

composer.lock

Lines changed: 375 additions & 439 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/ExecuteCommandTest.php

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,28 @@
77
use Chimera\Input;
88
use Chimera\MessageCreator;
99
use Chimera\ServiceBus;
10+
use PHPUnit\Framework\Attributes as PHPUnit;
1011
use PHPUnit\Framework\MockObject\MockObject;
1112
use PHPUnit\Framework\TestCase;
1213
use RuntimeException;
1314
use stdClass;
1415

15-
/** @coversDefaultClass \Chimera\ExecuteCommand */
16+
#[PHPUnit\CoversClass(ExecuteCommand::class)]
1617
final class ExecuteCommandTest extends TestCase
1718
{
18-
// phpcs:disable PSR12.Operators.OperatorSpacing.NoSpaceBefore -- PHPCS isn't ready for PHP 8.1 features yet
19-
// phpcs:disable PSR12.Operators.OperatorSpacing.NoSpaceAfter
2019
private ServiceBus&MockObject $bus;
2120
private Input&MockObject $input;
2221
private MessageCreator&MockObject $messageCreator;
23-
// phpcs:enable PSR12.Operators.OperatorSpacing.NoSpaceBefore
24-
// phpcs:enable PSR12.Operators.OperatorSpacing.NoSpaceAfter
2522

26-
/** @before */
23+
#[PHPUnit\Before]
2724
public function createDependencies(): void
2825
{
2926
$this->bus = $this->createMock(ServiceBus::class);
3027
$this->input = $this->createMock(Input::class);
3128
$this->messageCreator = $this->createMock(MessageCreator::class);
3229
}
3330

34-
/**
35-
* @test
36-
*
37-
* @covers ::__construct()
38-
* @covers ::execute()
39-
*/
31+
#[PHPUnit\Test]
4032
public function executeShouldCreateTheMessageAndHandleItWithTheBus(): void
4133
{
4234
$command = new stdClass();
@@ -53,12 +45,7 @@ public function executeShouldCreateTheMessageAndHandleItWithTheBus(): void
5345
$this->executeAction();
5446
}
5547

56-
/**
57-
* @test
58-
*
59-
* @covers ::__construct()
60-
* @covers ::execute()
61-
*/
48+
#[PHPUnit\Test]
6249
public function executeShouldNotCatchExceptionsFromBus(): void
6350
{
6451
$command = new stdClass();
@@ -78,12 +65,7 @@ public function executeShouldNotCatchExceptionsFromBus(): void
7865
$this->executeAction();
7966
}
8067

81-
/**
82-
* @test
83-
*
84-
* @covers ::__construct()
85-
* @covers ::execute()
86-
*/
68+
#[PHPUnit\Test]
8769
public function executeShouldNotCatchExceptionsFromMessageCreator(): void
8870
{
8971
$exception = new RuntimeException('Message creation failed');

tests/ExecuteQueryTest.php

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,28 @@
77
use Chimera\Input;
88
use Chimera\MessageCreator;
99
use Chimera\ServiceBus;
10+
use PHPUnit\Framework\Attributes as PHPUnit;
1011
use PHPUnit\Framework\MockObject\MockObject;
1112
use PHPUnit\Framework\TestCase;
1213
use RuntimeException;
1314
use stdClass;
1415

15-
/** @coversDefaultClass \Chimera\ExecuteQuery */
16+
#[PHPUnit\CoversClass(ExecuteQuery::class)]
1617
final class ExecuteQueryTest extends TestCase
1718
{
18-
// phpcs:disable PSR12.Operators.OperatorSpacing.NoSpaceBefore -- PHPCS isn't ready for PHP 8.1 features yet
19-
// phpcs:disable PSR12.Operators.OperatorSpacing.NoSpaceAfter
2019
private ServiceBus&MockObject $bus;
2120
private Input&MockObject $input;
2221
private MessageCreator&MockObject $messageCreator;
23-
// phpcs:enable PSR12.Operators.OperatorSpacing.NoSpaceBefore
24-
// phpcs:enable PSR12.Operators.OperatorSpacing.NoSpaceAfter
2522

26-
/** @before */
23+
#[PHPUnit\Before]
2724
public function createDependencies(): void
2825
{
2926
$this->bus = $this->createMock(ServiceBus::class);
3027
$this->input = $this->createMock(Input::class);
3128
$this->messageCreator = $this->createMock(MessageCreator::class);
3229
}
3330

34-
/**
35-
* @test
36-
*
37-
* @covers ::__construct()
38-
* @covers ::fetch()
39-
*/
31+
#[PHPUnit\Test]
4032
public function fetchShouldCreateTheMessageAndHandleItWithTheBus(): void
4133
{
4234
$query = new stdClass();
@@ -54,12 +46,7 @@ public function fetchShouldCreateTheMessageAndHandleItWithTheBus(): void
5446
self::assertSame('testing OK', $this->executeAction());
5547
}
5648

57-
/**
58-
* @test
59-
*
60-
* @covers ::__construct()
61-
* @covers ::fetch()
62-
*/
49+
#[PHPUnit\Test]
6350
public function fetchShouldNotCatchExceptionsFromBus(): void
6451
{
6552
$command = new stdClass();
@@ -79,12 +66,7 @@ public function fetchShouldNotCatchExceptionsFromBus(): void
7966
$this->executeAction();
8067
}
8168

82-
/**
83-
* @test
84-
*
85-
* @covers ::__construct()
86-
* @covers ::fetch()
87-
*/
69+
#[PHPUnit\Test]
8870
public function fetchShouldNotCatchExceptionsFromMessageCreator(): void
8971
{
9072
$exception = new RuntimeException('Message creation failed');

tests/IdentifierGenerator/RamseyUuidTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
namespace Chimera\Tests\IdentifierGenerator;
55

66
use Chimera\IdentifierGenerator\RamseyUuid;
7+
use PHPUnit\Framework\Attributes as PHPUnit;
78
use PHPUnit\Framework\TestCase;
89
use Ramsey\Uuid\Lazy\LazyUuidFromString;
910

10-
/** @covers \Chimera\IdentifierGenerator\RamseyUuid */
11+
#[PHPUnit\CoversClass(RamseyUuid::class)]
1112
final class RamseyUuidTest extends TestCase
1213
{
13-
/** @test */
14+
#[PHPUnit\Test]
1415
public function generateShouldReturnAUuidVersion4(): void
1516
{
1617
$generator = new RamseyUuid();
@@ -19,7 +20,7 @@ public function generateShouldReturnAUuidVersion4(): void
1920
self::assertInstanceOf(LazyUuidFromString::class, $identifier);
2021
}
2122

22-
/** @test */
23+
#[PHPUnit\Test]
2324
public function generateShouldAlwaysReturnANewIdentifier(): void
2425
{
2526
$generator = new RamseyUuid();

tests/MessageCreator/InputExtractor/AppendGeneratedIdentifierTest.php

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
<?php
22
declare(strict_types=1);
33

4-
namespace Chimera\MessageCreator\Tests\Unit\InputExtractor;
4+
namespace Chimera\Tests\MessageCreator\InputExtractor;
55

66
use Chimera\Input;
77
use Chimera\MessageCreator\InputExtractor\AppendGeneratedIdentifier;
88
use Chimera\MessageCreator\InputExtractor\UseInputData;
9+
use PHPUnit\Framework\Attributes as PHPUnit;
910
use PHPUnit\Framework\TestCase;
1011
use Ramsey\Uuid\Uuid;
1112

12-
/**
13-
* @coversDefaultClass \Chimera\MessageCreator\InputExtractor\AppendGeneratedIdentifier
14-
*
15-
* @uses \Chimera\MessageCreator\InputExtractor\UseInputData
16-
*/
13+
#[PHPUnit\CoversClass(AppendGeneratedIdentifier::class)]
14+
#[PHPUnit\UsesClass(UseInputData::class)]
1715
final class AppendGeneratedIdentifierTest extends TestCase
1816
{
19-
/**
20-
* @test
21-
*
22-
* @covers ::__construct
23-
* @covers ::extractData
24-
*/
17+
#[PHPUnit\Test]
2518
public function extractDataShouldAddTheIdentifierAttributeWhenItExists(): void
2619
{
2720
$id = Uuid::uuid4();
@@ -35,12 +28,7 @@ public function extractDataShouldAddTheIdentifierAttributeWhenItExists(): void
3528
self::assertSame(['id' => $id, 'testing' => 1], $extractor->extractData($input));
3629
}
3730

38-
/**
39-
* @test
40-
*
41-
* @covers ::__construct
42-
* @covers ::extractData
43-
*/
31+
#[PHPUnit\Test]
4432
public function extractDataShouldOverrideInputData(): void
4533
{
4634
$id = Uuid::uuid4();
@@ -54,12 +42,7 @@ public function extractDataShouldOverrideInputData(): void
5442
self::assertSame(['id' => $id, 'testing' => 1], $extractor->extractData($input));
5543
}
5644

57-
/**
58-
* @test
59-
*
60-
* @covers ::__construct
61-
* @covers ::extractData
62-
*/
45+
#[PHPUnit\Test]
6346
public function extractDataShouldReturnTheInputDataWhenIdentifierAttributeDoesNotExist(): void
6447
{
6548
$input = $this->createMock(Input::class);

tests/MessageCreator/InputExtractor/UseInputDataTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
<?php
22
declare(strict_types=1);
33

4-
namespace Chimera\MessageCreator\Tests\Unit\InputExtractor;
4+
namespace Chimera\Tests\MessageCreator\InputExtractor;
55

66
use Chimera\Input;
77
use Chimera\MessageCreator\InputExtractor\UseInputData;
8+
use PHPUnit\Framework\Attributes as PHPUnit;
89
use PHPUnit\Framework\TestCase;
910

10-
/** @coversDefaultClass \Chimera\MessageCreator\InputExtractor\UseInputData */
11+
#[PHPUnit\CoversClass(UseInputData::class)]
1112
final class UseInputDataTest extends TestCase
1213
{
13-
/**
14-
* @test
15-
*
16-
* @covers ::extractData
17-
*/
14+
#[PHPUnit\Test]
1815
public function extractDataShouldReturnTheInputData(): void
1916
{
2017
$input = $this->createMock(Input::class);

tests/MessageCreator/NamedConstructorTest.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@
66
use Chimera\Input;
77
use Chimera\MessageCreator\MessageCannotBeCreated;
88
use Chimera\MessageCreator\NamedConstructor;
9+
use PHPUnit\Framework\Attributes as PHPUnit;
910
use PHPUnit\Framework\TestCase;
1011

1112
use function uniqid;
1213

13-
/**
14-
* @covers \Chimera\MessageCreator\NamedConstructor
15-
* @covers \Chimera\MessageCreator\MessageCannotBeCreated
16-
*
17-
* @uses \Chimera\Tests\MessageCreator\DoStuff
18-
*/
14+
#[PHPUnit\CoversClass(NamedConstructor::class)]
15+
#[PHPUnit\CoversClass(MessageCannotBeCreated::class)]
16+
#[PHPUnit\UsesClass(DoStuff::class)]
1917
final class NamedConstructorTest extends TestCase
2018
{
21-
/** @test */
19+
#[PHPUnit\Test]
2220
public function createShouldUseDefaultCallbackToCreateTheMessageWhenNothingIsProvided(): void
2321
{
2422
$id = uniqid('testing', true);
@@ -34,7 +32,7 @@ public function createShouldUseDefaultCallbackToCreateTheMessageWhenNothingIsPro
3432
self::assertSame([$id], $message->extra);
3533
}
3634

37-
/** @test */
35+
#[PHPUnit\Test]
3836
public function createShouldUseACustomisedConstructorWhenItWasConfigured(): void
3937
{
4038
$input = $this->createMock(Input::class);
@@ -46,7 +44,7 @@ public function createShouldUseACustomisedConstructorWhenItWasConfigured(): void
4644
self::assertSame(['testing'], $message->extra);
4745
}
4846

49-
/** @test */
47+
#[PHPUnit\Test]
5048
public function createShouldRaiseExceptionWhenNamedConstructorDoesNotExist(): void
5149
{
5250
$creator = new NamedConstructor('nonExistingMethod');

0 commit comments

Comments
 (0)