Skip to content

Commit 0dd5ade

Browse files
authored
V1.4 (#21)
* chore: update dependencies (laravel + php) * remove support of Laravel 8
1 parent 585f297 commit 0dd5ade

File tree

11 files changed

+106
-71
lines changed

11 files changed

+106
-71
lines changed

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
php_version: ['8.1', '8.2']
19+
php_version: ['8.1', '8.2', '8.3']
2020

2121
steps:
2222
- uses: actions/checkout@v3

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
"type": "library",
1212
"require": {
1313
"php": "^8.1",
14-
"illuminate/collections": "^8.0|^9.0|^10.0",
15-
"illuminate/http": "^8.0|^9.0|^10.0",
16-
"illuminate/support": "^8.0|^9.0|^10.0"
14+
"illuminate/collections": "^9.0|^10.0|^11.0",
15+
"illuminate/http": "^9.0|^10.0|^11.0",
16+
"illuminate/support": "^9.0|^10.0|^11.0"
1717
},
1818
"require-dev": {
1919
"phpunit/phpunit": "^9.5|^10.0",
20-
"orchestra/testbench": "^7.0|^8.0",
20+
"orchestra/testbench": "^7.0|^8.0|^9.0|^10.0",
2121
"phpstan/phpstan": "^1.9.18"
2222
},
2323
"license": "MIT",

phpstan.neon

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ parameters:
66
- tests/app/migrations.php
77
- tests/app/routes.php
88
level: 6
9-
checkGenericClassInNonGenericObjectType: false
9+
10+
ignoreErrors:
11+
-
12+
identifier: missingType.generics

phpunit.php8.1.xml.dist

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
executionOrder="depends,defects"
66
failOnRisky="true"
7-
failOnWarning="true">
8-
<testsuites>
9-
<testsuite name="Unit">
10-
<directory>tests/Unit</directory>
11-
</testsuite>
12-
<testsuite name="Feature">
13-
<directory>tests/Feature</directory>
14-
</testsuite>
15-
</testsuites>
16-
<coverage>
17-
<include>
18-
<directory suffix=".php">src</directory>
19-
</include>
20-
</coverage>
21-
<php>
22-
<env name="DB_CONNECTION" value="sqlite"/>
23-
<env name="DB_DATABASE" value=":memory:"/>
24-
</php>
7+
failOnWarning="true"
8+
>
9+
<testsuites>
10+
<testsuite name="Unit">
11+
<directory>tests/Unit</directory>
12+
</testsuite>
13+
<testsuite name="Feature">
14+
<directory>tests/Feature</directory>
15+
</testsuite>
16+
</testsuites>
17+
<php>
18+
<env name="DB_CONNECTION" value="sqlite"/>
19+
<env name="DB_DATABASE" value=":memory:"/>
20+
</php>
21+
<source>
22+
<include>
23+
<directory suffix=".php">src</directory>
24+
</include>
25+
</source>
2526
</phpunit>

phpunit.php8.2.xml.dist

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
executionOrder="depends,defects"
66
failOnRisky="true"
7-
failOnWarning="true">
8-
<testsuites>
9-
<testsuite name="Unit">
10-
<directory>tests/Unit</directory>
11-
</testsuite>
12-
<testsuite name="Feature">
13-
<directory>tests/Feature</directory>
14-
</testsuite>
15-
</testsuites>
16-
<coverage>
17-
<include>
18-
<directory suffix=".php">src</directory>
19-
</include>
20-
</coverage>
21-
<php>
22-
<env name="DB_CONNECTION" value="sqlite"/>
23-
<env name="DB_DATABASE" value=":memory:"/>
24-
</php>
7+
failOnWarning="true"
8+
>
9+
<testsuites>
10+
<testsuite name="Unit">
11+
<directory>tests/Unit</directory>
12+
</testsuite>
13+
<testsuite name="Feature">
14+
<directory>tests/Feature</directory>
15+
</testsuite>
16+
</testsuites>
17+
<php>
18+
<env name="DB_CONNECTION" value="sqlite"/>
19+
<env name="DB_DATABASE" value=":memory:"/>
20+
</php>
21+
<source>
22+
<include>
23+
<directory suffix=".php">src</directory>
24+
</include>
25+
</source>
2526
</phpunit>

phpunit.php8.3.xml.dist

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
executionOrder="depends,defects"
6+
failOnRisky="true"
7+
failOnWarning="true"
8+
>
9+
<testsuites>
10+
<testsuite name="Unit">
11+
<directory>tests/Unit</directory>
12+
</testsuite>
13+
<testsuite name="Feature">
14+
<directory>tests/Feature</directory>
15+
</testsuite>
16+
</testsuites>
17+
<php>
18+
<env name="DB_CONNECTION" value="sqlite"/>
19+
<env name="DB_DATABASE" value=":memory:"/>
20+
</php>
21+
<source>
22+
<include>
23+
<directory suffix=".php">src</directory>
24+
</include>
25+
</source>
26+
</phpunit>

phpunit.xml.dist

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
executionOrder="depends,defects"
66
failOnRisky="true"
7-
failOnWarning="true">
8-
<testsuites>
9-
<testsuite name="Unit">
10-
<directory>tests/Unit</directory>
11-
</testsuite>
12-
<testsuite name="Feature">
13-
<directory>tests/Feature</directory>
14-
</testsuite>
15-
</testsuites>
16-
<coverage>
17-
<include>
18-
<directory suffix=".php">src</directory>
19-
</include>
20-
</coverage>
21-
<php>
22-
<env name="DB_CONNECTION" value="sqlite"/>
23-
<env name="DB_DATABASE" value=":memory:"/>
24-
</php>
7+
failOnWarning="true"
8+
>
9+
<testsuites>
10+
<testsuite name="Unit">
11+
<directory>tests/Unit</directory>
12+
</testsuite>
13+
<testsuite name="Feature">
14+
<directory>tests/Feature</directory>
15+
</testsuite>
16+
</testsuites>
17+
<php>
18+
<env name="DB_CONNECTION" value="sqlite"/>
19+
<env name="DB_DATABASE" value=":memory:"/>
20+
</php>
21+
<source>
22+
<include>
23+
<directory suffix=".php">src</directory>
24+
</include>
25+
</source>
2526
</phpunit>

src/Resources/Relationship.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ public function forRelation(string $relation): self
144144
public function toArray(mixed $request, bool $included = true): array
145145
{
146146
$value = $this->whenIncluded && !$included
147-
? new MissingValue
148-
: value($this->value)
149-
?? new MissingValue;
147+
? null
148+
: value($this->value);
149+
$value ??= new MissingValue;
150150

151151
if ($this->asCollection && !is_subclass_of($this->resource, ResourceCollection::class)) {
152152
$resource = $this->resource::collection($value);

tests/Feature/FeatureTestCase.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ protected function defineRoutes($router)
2323
include __DIR__ . '/../app/routes.php';
2424
}
2525

26-
protected function afterRefreshingDatabase()
26+
protected function beforeRefreshingDatabase()
2727
{
2828
$this->loadMigrationsFrom(__DIR__ . '/../app/migrations.php');
29+
}
2930

31+
protected function afterRefreshingDatabase()
32+
{
3033
self::loadSeed();
3134
}
3235

tests/Feature/User/ResourceTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ public function testShowMultipleFailures()
126126
$response->assertUnprocessable();
127127
$response->assertJsonValidationErrors(['include' => [
128128
'The selected include is invalid.',
129-
'"posts" doesn\'t have relationship "one"',
130-
'"user" doesn\'t have relationship "two"',
129+
'"posts" doesn\'t have relationship "one".',
130+
'"user" doesn\'t have relationship "two".',
131131
], 'fields' => [
132132
'The selected fields is invalid.',
133-
'"user" doesn\'t have relationship "one_field"',
133+
'"user" doesn\'t have fields "one_field".',
134134
'"unknown" doesn\'t exists.',
135135
]]);
136136
}

0 commit comments

Comments
 (0)