Skip to content

Commit 4de0120

Browse files
authored
Bump PHPUnit to 11.x (#28)
1 parent 371ee36 commit 4de0120

Some content is hidden

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

59 files changed

+519
-1056
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ cs:
1313

1414
.PHONY: tests
1515
tests:
16-
php vendor/bin/phpunit -v
16+
php vendor/bin/phpunit

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"phpstan/extension-installer": "^1.0",
3737
"phpstan/phpstan": "^2.0",
3838
"phpstan/phpstan-webmozart-assert": "^2.0",
39-
"phpunit/phpunit": "^9.0",
39+
"phpunit/phpunit": "^11.5",
4040
"thecodingmachine/phpstan-safe-rule": "^1.4"
4141
},
4242
"config": {

phpunit.xml.dist

+6-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
colors="true"
88
columns="max"
99
executionOrder="random"
10-
verbose="true"
1110
>
1211
<php>
1312
<ini name="error_reporting" value="-1" />
@@ -16,20 +15,17 @@
1615
</php>
1716

1817
<testsuites>
19-
<testsuite name="all">
20-
<directory>tests</directory>
21-
</testsuite>
2218
<testsuite name="unit">
2319
<directory>tests/Unit</directory>
2420
</testsuite>
2521
<testsuite name="integration">
26-
<directory>tests/Unit</directory>
22+
<directory>tests/Integration</directory>
2723
</testsuite>
2824
</testsuites>
2925

30-
<filter>
31-
<whitelist>
32-
<directory>src</directory>
33-
</whitelist>
34-
</filter>
26+
<source>
27+
<include>
28+
<directory suffix=".php">src</directory>
29+
</include>
30+
</source>
3531
</phpunit>

tests/Integration/DatasourcesApiTest.php

+5-12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Storyblok\Api\Tests\Integration;
1515

16+
use PHPUnit\Framework\Attributes\Test;
1617
use PHPUnit\Framework\TestCase;
1718
use Storyblok\Api\DatasourcesApi;
1819
use Storyblok\Api\Domain\Value\Dto\Pagination;
@@ -30,9 +31,7 @@ class DatasourcesApiTest extends TestCase
3031
{
3132
use FakerTrait;
3233

33-
/**
34-
* @test
35-
*/
34+
#[Test]
3635
public function allDatasourcesAreRetrievedSuccessfully(): void
3736
{
3837
$client = StoryblokFakeClient::willRespond(
@@ -46,9 +45,7 @@ public function allDatasourcesAreRetrievedSuccessfully(): void
4645
self::assertInstanceOf(DatasourcesResponse::class, $response);
4746
}
4847

49-
/**
50-
* @test
51-
*/
48+
#[Test]
5249
public function datasourceIsRetrievedBySlugSuccessfully(): void
5350
{
5451
$client = StoryblokFakeClient::willRespond(
@@ -61,9 +58,7 @@ public function datasourceIsRetrievedBySlugSuccessfully(): void
6158
self::assertInstanceOf(DatasourceResponse::class, $response);
6259
}
6360

64-
/**
65-
* @test
66-
*/
61+
#[Test]
6762
public function exceptionIsThrownWhenRetrievingAllDatasourcesFails(): void
6863
{
6964
$client = StoryblokFakeClient::willThrowException(new \Exception());
@@ -74,9 +69,7 @@ public function exceptionIsThrownWhenRetrievingAllDatasourcesFails(): void
7469
$api->all(new DatasourcesRequest(pagination: new Pagination(1, 10)));
7570
}
7671

77-
/**
78-
* @test
79-
*/
72+
#[Test]
8073
public function exceptionIsThrownWhenRetrievingDatasourceBySlugFails(): void
8174
{
8275
$client = StoryblokFakeClient::willThrowException(new \Exception());

tests/Integration/DatasourcesEntriesApiTest.php

+9-24
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Storyblok\Api\Tests\Integration;
1515

16+
use PHPUnit\Framework\Attributes\Test;
1617
use PHPUnit\Framework\TestCase;
1718
use Storyblok\Api\DatasourceEntriesApi;
1819
use Storyblok\Api\Domain\Value\Dto\Pagination;
@@ -29,9 +30,7 @@ class DatasourcesEntriesApiTest extends TestCase
2930
{
3031
use FakerTrait;
3132

32-
/**
33-
* @test
34-
*/
33+
#[Test]
3534
public function allDatasourceEntriesAreRetrievedSuccessfully(): void
3635
{
3736
$client = StoryblokFakeClient::willRespond(
@@ -45,9 +44,7 @@ public function allDatasourceEntriesAreRetrievedSuccessfully(): void
4544
self::assertInstanceOf(DatasourceEntriesResponse::class, $response);
4645
}
4746

48-
/**
49-
* @test
50-
*/
47+
#[Test]
5148
public function allDatasourceEntriesByDatasourceAreRetrievedSuccessfully(): void
5249
{
5350
$client = StoryblokFakeClient::willRespond(
@@ -64,9 +61,7 @@ public function allDatasourceEntriesByDatasourceAreRetrievedSuccessfully(): void
6461
self::assertInstanceOf(DatasourceEntriesResponse::class, $response);
6562
}
6663

67-
/**
68-
* @test
69-
*/
64+
#[Test]
7065
public function allDatasourceEntriesByDimensionAreRetrievedSuccessfully(): void
7166
{
7267
$client = StoryblokFakeClient::willRespond(
@@ -83,9 +78,7 @@ public function allDatasourceEntriesByDimensionAreRetrievedSuccessfully(): void
8378
self::assertInstanceOf(DatasourceEntriesResponse::class, $response);
8479
}
8580

86-
/**
87-
* @test
88-
*/
81+
#[Test]
8982
public function allDatasourceEntriesByDatasourceDimensionAreRetrievedSuccessfully(): void
9083
{
9184
$client = StoryblokFakeClient::willRespond(
@@ -103,9 +96,7 @@ public function allDatasourceEntriesByDatasourceDimensionAreRetrievedSuccessfull
10396
self::assertInstanceOf(DatasourceEntriesResponse::class, $response);
10497
}
10598

106-
/**
107-
* @test
108-
*/
99+
#[Test]
109100
public function exceptionIsThrownWhenRetrievingAllDatasourceEntriesFails(): void
110101
{
111102
$client = StoryblokFakeClient::willThrowException(new \Exception());
@@ -116,9 +107,7 @@ public function exceptionIsThrownWhenRetrievingAllDatasourceEntriesFails(): void
116107
$api->all(new DatasourceEntriesRequest(pagination: new Pagination(1, 10)));
117108
}
118109

119-
/**
120-
* @test
121-
*/
110+
#[Test]
122111
public function exceptionIsThrownWhenRetrievingDatasourceEntriesByDatasourceFails(): void
123112
{
124113
$client = StoryblokFakeClient::willThrowException(new \Exception());
@@ -132,9 +121,7 @@ public function exceptionIsThrownWhenRetrievingDatasourceEntriesByDatasourceFail
132121
);
133122
}
134123

135-
/**
136-
* @test
137-
*/
124+
#[Test]
138125
public function exceptionIsThrownWhenRetrievingDatasourceEntriesByDimensionFails(): void
139126
{
140127
$client = StoryblokFakeClient::willThrowException(new \Exception());
@@ -148,9 +135,7 @@ public function exceptionIsThrownWhenRetrievingDatasourceEntriesByDimensionFails
148135
);
149136
}
150137

151-
/**
152-
* @test
153-
*/
138+
#[Test]
154139
public function exceptionIsThrownWhenRetrievingDatasourceEntriesByDatasourceDimensionFails(): void
155140
{
156141
$client = StoryblokFakeClient::willThrowException(new \Exception());

tests/Integration/LinksApiTest.php

+4-9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Storyblok\Api\Tests\Integration;
1515

16+
use PHPUnit\Framework\Attributes\Test;
1617
use PHPUnit\Framework\TestCase;
1718
use Storyblok\Api\Domain\Value\Id;
1819
use Storyblok\Api\LinksApi;
@@ -27,9 +28,7 @@ final class LinksApiTest extends TestCase
2728
{
2829
use FakerTrait;
2930

30-
/**
31-
* @test
32-
*/
31+
#[Test]
3332
public function all(): void
3433
{
3534
$client = StoryblokFakeClient::willRespond(
@@ -44,9 +43,7 @@ public function all(): void
4443
self::assertSame(1, $response->total->value);
4544
}
4645

47-
/**
48-
* @test
49-
*/
46+
#[Test]
5047
public function byParent(): void
5148
{
5249
$client = StoryblokFakeClient::willRespond(
@@ -61,9 +58,7 @@ public function byParent(): void
6158
self::assertSame(1, $response->total->value);
6259
}
6360

64-
/**
65-
* @test
66-
*/
61+
#[Test]
6762
public function roots(): void
6863
{
6964
$client = StoryblokFakeClient::willRespond(

tests/Integration/SpacesApiTest.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Storyblok\Api\Tests\Integration;
1515

16+
use PHPUnit\Framework\Attributes\Test;
1617
use PHPUnit\Framework\TestCase;
1718
use Storyblok\Api\Domain\Value\Space;
1819
use Storyblok\Api\Response\SpaceResponse;
@@ -30,9 +31,7 @@ final class SpacesApiTest extends TestCase
3031
{
3132
use FakerTrait;
3233

33-
/**
34-
* @test
35-
*/
34+
#[Test]
3635
public function me(): void
3736
{
3837
$client = self::createClient([
@@ -58,9 +57,7 @@ public function me(): void
5857
self::assertSame(['de', 'en'], $space->languageCodes);
5958
}
6059

61-
/**
62-
* @test
63-
*/
60+
#[Test]
6461
public function meThrowsExceptionIfSpaceIsMissing(): void
6562
{
6663
$client = self::createClient([]);

tests/Integration/StoriesApiTest.php

+11-30
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Storyblok\Api\Tests\Integration;
1515

16+
use PHPUnit\Framework\Attributes\Test;
1617
use PHPUnit\Framework\TestCase;
1718
use Storyblok\Api\Domain\Value\Id;
1819
use Storyblok\Api\Domain\Value\Uuid;
@@ -30,9 +31,7 @@ final class StoriesApiTest extends TestCase
3031
{
3132
use FakerTrait;
3233

33-
/**
34-
* @test
35-
*/
34+
#[Test]
3635
public function allStoriesAreRetrievedSuccessfully(): void
3736
{
3837
$client = StoryblokFakeClient::willRespond(
@@ -47,9 +46,7 @@ public function allStoriesAreRetrievedSuccessfully(): void
4746
self::assertSame(1, $response->total->value);
4847
}
4948

50-
/**
51-
* @test
52-
*/
49+
#[Test]
5350
public function allStoriesByContentTypeAreRetrievedSuccessfully(): void
5451
{
5552
$client = StoryblokFakeClient::willRespond(
@@ -64,9 +61,7 @@ public function allStoriesByContentTypeAreRetrievedSuccessfully(): void
6461
self::assertSame(1, $response->total->value);
6562
}
6663

67-
/**
68-
* @test
69-
*/
64+
#[Test]
7065
public function storyBySlugIsRetrievedSuccessfully(): void
7166
{
7267
$client = StoryblokFakeClient::willRespond(
@@ -79,9 +74,7 @@ public function storyBySlugIsRetrievedSuccessfully(): void
7974
self::assertInstanceOf(StoryResponse::class, $response);
8075
}
8176

82-
/**
83-
* @test
84-
*/
77+
#[Test]
8578
public function storyByUuidIsRetrievedSuccessfully(): void
8679
{
8780
$client = StoryblokFakeClient::willRespond(
@@ -94,9 +87,7 @@ public function storyByUuidIsRetrievedSuccessfully(): void
9487
self::assertInstanceOf(StoryResponse::class, $response);
9588
}
9689

97-
/**
98-
* @test
99-
*/
90+
#[Test]
10091
public function storyByIdIsRetrievedSuccessfully(): void
10192
{
10293
$client = StoryblokFakeClient::willRespond(
@@ -109,9 +100,7 @@ public function storyByIdIsRetrievedSuccessfully(): void
109100
self::assertInstanceOf(StoryResponse::class, $response);
110101
}
111102

112-
/**
113-
* @test
114-
*/
103+
#[Test]
115104
public function exceptionIsThrownWhenRetrievingAllStoriesFails(): void
116105
{
117106
$client = StoryblokFakeClient::willThrowException(new \Exception());
@@ -122,9 +111,7 @@ public function exceptionIsThrownWhenRetrievingAllStoriesFails(): void
122111
$api->all();
123112
}
124113

125-
/**
126-
* @test
127-
*/
114+
#[Test]
128115
public function exceptionIsThrownWhenRetrievingAllStoriesByContentTypeFails(): void
129116
{
130117
$client = StoryblokFakeClient::willThrowException(new \Exception());
@@ -135,9 +122,7 @@ public function exceptionIsThrownWhenRetrievingAllStoriesByContentTypeFails(): v
135122
$api->allByContentType(self::faker()->word());
136123
}
137124

138-
/**
139-
* @test
140-
*/
125+
#[Test]
141126
public function exceptionIsThrownWhenRetrievingAllStoriesByIdFails(): void
142127
{
143128
$client = StoryblokFakeClient::willThrowException(new \Exception());
@@ -148,9 +133,7 @@ public function exceptionIsThrownWhenRetrievingAllStoriesByIdFails(): void
148133
$api->byId(new Id(self::faker()->numberBetween(1)));
149134
}
150135

151-
/**
152-
* @test
153-
*/
136+
#[Test]
154137
public function exceptionIsThrownWhenRetrievingAllStoriesByUuidFails(): void
155138
{
156139
$client = StoryblokFakeClient::willThrowException(new \Exception());
@@ -161,9 +144,7 @@ public function exceptionIsThrownWhenRetrievingAllStoriesByUuidFails(): void
161144
$api->byUuid(new Uuid(self::faker()->uuid()));
162145
}
163146

164-
/**
165-
* @test
166-
*/
147+
#[Test]
167148
public function exceptionIsThrownWhenRetrievingAllStoriesBySlugFails(): void
168149
{
169150
$client = StoryblokFakeClient::willThrowException(new \Exception());

0 commit comments

Comments
 (0)