Skip to content

Commit

Permalink
V1.4 (#21)
Browse files Browse the repository at this point in the history
* chore: update dependencies (laravel + php)

* remove support of Laravel 8
  • Loading branch information
Ark4ne authored Aug 6, 2024
1 parent 585f297 commit 0dd5ade
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
php_version: ['8.1', '8.2']
php_version: ['8.1', '8.2', '8.3']

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"type": "library",
"require": {
"php": "^8.1",
"illuminate/collections": "^8.0|^9.0|^10.0",
"illuminate/http": "^8.0|^9.0|^10.0",
"illuminate/support": "^8.0|^9.0|^10.0"
"illuminate/collections": "^9.0|^10.0|^11.0",
"illuminate/http": "^9.0|^10.0|^11.0",
"illuminate/support": "^9.0|^10.0|^11.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5|^10.0",
"orchestra/testbench": "^7.0|^8.0",
"orchestra/testbench": "^7.0|^8.0|^9.0|^10.0",
"phpstan/phpstan": "^1.9.18"
},
"license": "MIT",
Expand Down
5 changes: 4 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ parameters:
- tests/app/migrations.php
- tests/app/routes.php
level: 6
checkGenericClassInNonGenericObjectType: false

ignoreErrors:
-
identifier: missingType.generics
39 changes: 20 additions & 19 deletions phpunit.php8.1.xml.dist
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<php>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
failOnWarning="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<php>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
39 changes: 20 additions & 19 deletions phpunit.php8.2.xml.dist
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<php>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
failOnWarning="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<php>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
26 changes: 26 additions & 0 deletions phpunit.php8.3.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
failOnRisky="true"
failOnWarning="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<php>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
39 changes: 20 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<php>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
failOnWarning="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<php>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
6 changes: 3 additions & 3 deletions src/Resources/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ public function forRelation(string $relation): self
public function toArray(mixed $request, bool $included = true): array
{
$value = $this->whenIncluded && !$included
? new MissingValue
: value($this->value)
?? new MissingValue;
? null
: value($this->value);
$value ??= new MissingValue;

if ($this->asCollection && !is_subclass_of($this->resource, ResourceCollection::class)) {
$resource = $this->resource::collection($value);
Expand Down
5 changes: 4 additions & 1 deletion tests/Feature/FeatureTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ protected function defineRoutes($router)
include __DIR__ . '/../app/routes.php';
}

protected function afterRefreshingDatabase()
protected function beforeRefreshingDatabase()
{
$this->loadMigrationsFrom(__DIR__ . '/../app/migrations.php');
}

protected function afterRefreshingDatabase()
{
self::loadSeed();
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/User/ResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ public function testShowMultipleFailures()
$response->assertUnprocessable();
$response->assertJsonValidationErrors(['include' => [
'The selected include is invalid.',
'"posts" doesn\'t have relationship "one"',
'"user" doesn\'t have relationship "two"',
'"posts" doesn\'t have relationship "one".',
'"user" doesn\'t have relationship "two".',
], 'fields' => [
'The selected fields is invalid.',
'"user" doesn\'t have relationship "one_field"',
'"user" doesn\'t have fields "one_field".',
'"unknown" doesn\'t exists.',
]]);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Support/ValuesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function isMissing()
/**
* Return a list of data to test hasAttribute method
*/
public function dataAttribute()
public static function dataAttribute()
{
return [
'array' => [['a' => 1], 'a', true, 1],
Expand Down

0 comments on commit 0dd5ade

Please sign in to comment.