7
7
use Chimera \Input ;
8
8
use Chimera \MessageCreator ;
9
9
use Chimera \ServiceBus ;
10
+ use PHPUnit \Framework \Attributes as PHPUnit ;
10
11
use PHPUnit \Framework \MockObject \MockObject ;
11
12
use PHPUnit \Framework \TestCase ;
12
13
use RuntimeException ;
13
14
use stdClass ;
14
15
15
- /** @coversDefaultClass \Chimera\ ExecuteQuery */
16
+ #[ PHPUnit \CoversClass( ExecuteQuery::class)]
16
17
final class ExecuteQueryTest extends TestCase
17
18
{
18
- // phpcs:disable PSR12.Operators.OperatorSpacing.NoSpaceBefore -- PHPCS isn't ready for PHP 8.1 features yet
19
- // phpcs:disable PSR12.Operators.OperatorSpacing.NoSpaceAfter
20
19
private ServiceBus &MockObject $ bus ;
21
20
private Input &MockObject $ input ;
22
21
private MessageCreator &MockObject $ messageCreator ;
23
- // phpcs:enable PSR12.Operators.OperatorSpacing.NoSpaceBefore
24
- // phpcs:enable PSR12.Operators.OperatorSpacing.NoSpaceAfter
25
22
26
- /** @before */
23
+ #[ PHPUnit \Before]
27
24
public function createDependencies (): void
28
25
{
29
26
$ this ->bus = $ this ->createMock (ServiceBus::class);
30
27
$ this ->input = $ this ->createMock (Input::class);
31
28
$ this ->messageCreator = $ this ->createMock (MessageCreator::class);
32
29
}
33
30
34
- /**
35
- * @test
36
- *
37
- * @covers ::__construct()
38
- * @covers ::fetch()
39
- */
31
+ #[PHPUnit \Test]
40
32
public function fetchShouldCreateTheMessageAndHandleItWithTheBus (): void
41
33
{
42
34
$ query = new stdClass ();
@@ -54,12 +46,7 @@ public function fetchShouldCreateTheMessageAndHandleItWithTheBus(): void
54
46
self ::assertSame ('testing OK ' , $ this ->executeAction ());
55
47
}
56
48
57
- /**
58
- * @test
59
- *
60
- * @covers ::__construct()
61
- * @covers ::fetch()
62
- */
49
+ #[PHPUnit \Test]
63
50
public function fetchShouldNotCatchExceptionsFromBus (): void
64
51
{
65
52
$ command = new stdClass ();
@@ -79,12 +66,7 @@ public function fetchShouldNotCatchExceptionsFromBus(): void
79
66
$ this ->executeAction ();
80
67
}
81
68
82
- /**
83
- * @test
84
- *
85
- * @covers ::__construct()
86
- * @covers ::fetch()
87
- */
69
+ #[PHPUnit \Test]
88
70
public function fetchShouldNotCatchExceptionsFromMessageCreator (): void
89
71
{
90
72
$ exception = new RuntimeException ('Message creation failed ' );
0 commit comments