8000 tests: upgrade to phpunit 10 · cloudcreativity/laravel-json-api@75b73cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 75b73cf

Browse files
committed
tests: upgrade to phpunit 10
1 parent 0b29c36 commit 75b73cf

28 files changed

+87
-80
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
vendor/
22
composer.lock
3-
.phpunit.result.cache
3+
.phpunit.cache/

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"laravel/ui": "^4.2",
3939
"mockery/mockery": "^1.1",
4040
"orchestra/testbench": "^8.0",
41-
"phpunit/phpunit": "^9.5.28"
41+
"phpunit/phpunit": "^10.5"
4242
},
4343
"suggest": {
4444
"cloudcreativity/json-api-testing": "Required to use the test helpers."

phpunit.xml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
backupGlobals="false"
4-
backupStaticAttributes="false"
54
beStrictAboutTestsThatDoNotTestAnything="true"
65
bootstrap="vendor/autoload.php"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
convertDeprecationsToExceptions="true"
127
processIsolation="false"
138
stopOnError="false"
149
stopOnFailure="false"
15-
verbose="true"
16-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
10+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
11+
cacheDirectory=".phpunit.cache"
12+
backupStaticProperties="false"
13+
failOnWarning="true"
14+
failOnDeprecation="true"
15+
failOnNotice="true"
1716
>
18-
<coverage>
19-
<include>
20-
<directory suffix=".php">src/</directory>
21-
</include>
22-
</coverage>
17+
<coverage/>
2318
<testsuites>
2419
<testsuite name="Unit">
2520
<directory suffix="Test.php">./tests/lib/Unit/</directory>
@@ -36,4 +31,9 @@
3631
<ini name="memory_limit" value="256M"/>
3732
<env name="APP_KEY" value="base64:BMfTqJC1cFk6A/jTPsjQgC+cROx7TDaEeGIAat6CuqY="/>
3833
</php>
39-
</phpunit>
34+
<source>
35+
<include>
36+
<directory suffix=".php">src/</directory>
37+
</include>
38+
</source>
39+
</phpunit>

tests/dummy/tests/Feature/Avatars/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function setUp(): void
3737
/**
3838
* @return array
3939
*/
40-
public function fieldProvider(): array
40+
public static function fieldProvider(): array
4141
{
4242
return [
4343
'created-at' => ['created-at'],
@@ -50,7 +50,7 @@ public function fieldProvider(): array
5050
/**
5151
* @return array
5252
*/
53-
public function multipartProvider(): array
53+
public static function multipartProvider(): array
5454
{
5555
return [
5656
'form-data' => ['multipart/form-data'],

tests/lib/Integration/Auth/AuthTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function testApiAuthAllowed()
6868
/**
6969
* @return array
7070
*/
71-
public function resourceAuthProvider()
71+
public static function resourceAuthProvider()
7272
{
7373
return [
7474
[false, 'posts', 200],

tests/lib/Integration/Eloquent/HasOneTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function testCreateWithNull()
7878
/**
7979
* @return array
8080
*/
81-
public function confirmationProvider(): array
81+
public static function confirmationProvider(): array
8282
{
8383
return [
8484
['passwordConfirmation', 'foo'],

tests/lib/Integration/ErrorsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testCustom404()
7171
/**
7272
* @return array
7373
*/
74-
public function invalidDocumentProvider()
74+
public static function invalidDocumentProvider()
7575
{
7676
return [
7777
'empty' => [''],
@@ -118,7 +118,7 @@ public function testDocumentRequired($content, $method = 'POST')
118118
/**
119119
* @return array
120120
*/
121-
public function ignoreDocumentProvider()
121+
public static function ignoreDocumentProvider()
122122
{
123123
return [
124124
'empty' => [''],

tests/lib/Integration/GeneratorsTest.php

Lines changed: 1 addition & 57AE 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected function tearDown(): void
9595
/**
9696
* @return array
9797
*/
98-
public function byResourceProvider()
98+
public static function byResourceProvider()
9999
{
100100
return [
101101
'by-resource' => [true],

tests/lib/Integration/Issue154/IssueTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function setUp(): void
4444
/**
4545
* @return array
4646
*/
47-
public function createProvider()
47+
public static function createProvider()
4848
{
4949
return [
5050
['saving', ['creating', 'saved', 'created']],
@@ -93,7 +93,7 @@ public function testCreate($hook, array $unexpected)
9393
/**
9494
* @return array
9595
*/
96-
public function updateProvider()
96+
public static function updateProvider()
9797
{
9898
return [
9999
['saving', ['updating', 'saved', 'updated']],
@@ -133,7 +133,7 @@ public function testUpdate($hook, array $unexpected)
133133
/**
134134
* @return array
135135
*/
136-
public function deleteProvider()
136+
public static function deleteProvider()
137137
{
138138
return [
139139
['deleting', ['deleted']],

tests/lib/Integration/Queue/ControllerHooksTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function setUp(): void
4242
$mock = $this
4343
->getMockBuilder(Adapter::class)
4444
->setConstructorArgs([new StandardStrategy()])
45-
->setMethods(['create', 'update','delete'])
45+
->onlyMethods(['create', 'update','delete'])
4646
->getMock();
4747

4848
$mock->expects($this->never())->method('create');

tests/lib/Integration/Routing/CustomTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function setUp(): void
5858
/**
5959
* @return array
6060
*/
61-
public function versionProvider(): array
61+
public static function versionProvider(): array
6262
{
6363
return [
6464
'root' => ['/api/v1'],

tests/lib/Integration/Routing/Test.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Test extends TestCase
4040
/**
4141
* @var array
4242
*/
43-
private $defaults = [
43+
private static $defaults = [
4444
'index' => ['GET', '/api/v1/posts', '@index'],
4545
'create' => ['POST', '/api/v1/posts', '@create'],
4646
'read' => ['GET', '/api/v1/posts/1', '@read'],
@@ -59,19 +59,19 @@ class Test extends TestCase
5959
/**
6060
* @return array
6161
*/
62-
public function defaultsProvider()
62+
public static function defaultsProvider(): array
6363
{
64-
return $this->defaults;
64+
return self::$defaults;
6565
}
6666

6767
/**
6868
* Provider of all routes that relate to a specific record, i.e. have an id in them.
6969
*
7070
* @return array
7171
*/
72-
public function recordProvider()
72+
public static function recordProvider()
7373
{
74-
$args = $this->defaults;
74+
$args = self::$defaults;
7575
unset($args['index'], $args['create']);
7676

7777
return $args;
@@ -117,7 +117,7 @@ public function testFluentDefaults($method, $url, $action)
117117
/**
118118
* @return array
119119
*/
120-
public function uriProvider(): array
120+
public static function uriProvider(): array
121121
{
122122
return [
123123
'index' => ['GET', '/api/v1/blog_posts', '@index'],
@@ -268,7 +268,7 @@ public function testFluentControllerIsString($method, $url, $action)
268268
/**
269269
* @return array
270270
*/
271-
public function onlyProvider()
271+
public static function onlyProvider()
272272
{
273273
return [
274274
['index', [
@@ -328,7 +328,7 @@ public function testFluentOnly($only, array $matches)
328328
/**
329329
* @return array
330330
*/
331-
public function exceptProvider()
331+
public static function exceptProvider()
332332
{
333333
return [
334334
['create', [
@@ -388,7 +388,7 @@ public function testFluentExcept($except, array $matches)
388388
/**
389389
* @return array
390390
*/
391-
public function hasOneOnlyProvider()
391+
public static function hasOneOnlyProvider()
392392
{
393393
return [
394394
['related', [
@@ -450,7 +450,7 @@ public function testFluentHasOneOnly($only, array $matches)
450450
/**
451451
* @return array
452452
*/
453-
public function hasOneExceptProvider()
453+
public static function hasOneExceptProvider()
454454
{
455455
return [
456456
['related', [
@@ -548,7 +548,7 @@ public function testFluentHasOneInverse(): void
548548
/**
549549
* @return array
550550
*/
551-
public function hasManyOnlyProvider()
551+
public static function hasManyOnlyProvider()
552552
{
553553
return [
554554
['related', [
@@ -623,7 +623,7 @@ public function testFluentHasManyOnly($only, array $matches)
623623
/**
624624
* @return array
625625
*/
626-
public function hasManyExceptProvider()
626+
public static function hasManyExceptProvider()
627627
{
628628
return [
629629
['related', [
@@ -886,7 +886,7 @@ public function testFluentResourceIdConstraintOverridesDefaultIdConstraint($meth
886886
/**
887887
* @return array
888888
*/
889-
public function multiWordProvider()
889+
public static function multiWordProvider()
890890
{
891891
return [
892892
['end-users'],
@@ -936,7 +936,7 @@ public function testMultiWordRelationship($relationship)
936936
/**
937937
* @return array
938938
*/
939-
public function processProvider(): array
939+
public static function processProvider(): array
940940
{
941941
return [
942942
'fetch-many' => ['GET', '/api/v1/photos/queue-jobs', '@processes'],

tests/lib/Integration/UrlAndLinksTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class UrlAndLinksTest extends TestCase
3131
/**
3232
* @return array
3333
*/
34-
public function urlProvider()
34+
public static function urlProvider()
3535
{
3636
return [
3737
['/api/v1/posts', 'index'],

tests/lib/Integration/Validation/FailedMetaTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function setUp(): void
4545

4646
$this->validator = $this
4747
->getMockBuilder(Validators::class)
48-
->setMethods(['rules'])
48+
->onlyMethods(['rules'])
4949
->setConstructorArgs([$this->app->make(Factory::class), json_api('v1')->getContainer()])
5050
->getMock();
5151

@@ -64,7 +64,7 @@ protected function tearDown(): void
6464
/**
6565
* @return array
6666
*/
67-
public function rulesProvider(): array
67+
public static function rulesProvider(): array
6868
{
6969
return [
7070
'before_or_equal' => [

tests/lib/Integration/Validation/QueryValidationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function tearDown(): void
3636
/**
3737
* @return array
3838
*/
39-
public function searchProvider()
39+
public static function searchProvider()
4040
{
4141
return [
4242
'fields:not allowed (singular)' => [

tests/lib/Integration/Validation/Spec/RelationshipValidationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class RelationshipValidationTest extends TestCase
3030
/**
3131
* @return array
3232
*/
33-
public function toOneProvider()
33+
public static function toOneProvider()
3434
{
3535
return [
3636
'data:required' => [
@@ -217,7 +217,7 @@ public function toOneProvider()
217217
/**
218218
* @return array
219219
*/
220-
public function toManyProvider()
220+
public static function toManyProvider()
221221
{
222222
return [
223223
'data:required' => [

tests/lib/Integration/Validation/Spec/ResourceValidationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ResourceValidationTest extends TestCase
3131
/**
3232
* @return array
3333
*/
34-
public function postProvider()
34+
public static function postProvider()
3535
{
3636
return [
3737
'data:required' => [
@@ -398,7 +398,7 @@ public function postProvider()
398398
/**
399399
* @return array
400400
*/
401-
public function patchProvider()
401+
public static function patchProvider()
402402
{
403403
return [
404404
'data.id:required' => [

tests/lib/Unit/Document/ResourceObjectTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function testCannotSet(): void
225225
/**
226226
* @return array
227227
*/
228-
public function pointerProvider(): array
228+
public static function pointerProvider(): array
229229
{
230230
return [
231231
['type', '/type'],
@@ -267,7 +267,7 @@ public function testPointerWithPrefix(string $key, string $expected): void
267267
/**
268268
* @return array
269269
*/
270-
public function pointerForRelationshipProvider(): array
270+
public static function pointerForRelationshipProvider(): array
271271
{
272272
return [
273273
['author', null],

0 commit comments

Comments
 (0)
0