Skip to content

Commit e98734d

Browse files
committed
Merge branch 'release/1.1.0'
2 parents 592f0eb + fd231e7 commit e98734d

File tree

12 files changed

+87
-21
lines changed

12 files changed

+87
-21
lines changed

.github/workflows/tests.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
php: [7.4, '8.0', 8.1]
18+
laravel: [8.76, 9]
19+
exclude:
20+
- php: 7.4
21+
laravel: 9
22+
23+
steps:
24+
- name: Checkout Code
25+
uses: actions/checkout@v2
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php }}
31+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
32+
tools: composer:v2
33+
coverage: none
34+
ini-values: error_reporting=E_ALL
35+
36+
- name: Set Laravel Version
37+
run: composer require "laravel/framework:^${{ matrix.laravel }}" --no-update -n
38+
39+
- name: Install dependencies
40+
uses: nick-invision/retry@v1
41+
with:
42+
timeout_minutes: 5
43+
max_attempts: 5
44+
command: composer install --no-suggest --prefer-dist -n -o
45+
46+
- name: Execute tests
47+
run: vendor/bin/phpunit

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file. This project adheres to
44
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).
55

6+
## [1.1.0] - 2022-09-14
7+
8+
### Added
9+
10+
- Package now supports PHP 8.1 and Laravel 9.
11+
612
## [1.0.1] - 2021-07-31
713

814
### Fixed

composer.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
],
2525
"require": {
2626
"php": "^7.4|^8.0",
27-
"illuminate/support": "^8.0",
28-
"laravel-json-api/eloquent": "^1.0.0",
29-
"tenantcloud/laravel-boolean-softdeletes": "^3.1"
27+
"illuminate/support": "^8.0|^9.0",
28+
"laravel-json-api/eloquent": "^1.0.1|^2.0",
29+
"tenantcloud/laravel-boolean-softdeletes": "^3.1|^4.0"
3030
},
3131
"require-dev": {
32-
"orchestra/testbench": "^6.17",
33-
"phpunit/phpunit": "^9.5"
32+
"orchestra/testbench": "^6.23|^7.0",
33+
"phpunit/phpunit": "^9.5.10"
3434
},
3535
"autoload": {
3636
"psr-4": {
@@ -49,7 +49,7 @@
4949
"dev-develop": "1.x-dev"
5050
}
5151
},
52-
"minimum-stability": "stable",
52+
"minimum-stability": "dev",
5353
"prefer-stable": true,
5454
"config": {
5555
"sort-packages": true

phpunit.xml

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
convertErrorsToExceptions="true"
2525
convertNoticesToExceptions="true"
2626
convertWarningsToExceptions="true"
27+
convertDeprecationsToExceptions="true"
2728
processIsolation="false"
2829
stopOnError="false"
2930
stopOnFailure="false"
@@ -47,6 +48,7 @@
4748
</testsuite>
4849
</testsuites>
4950
<php>
51+
<ini name="error_reporting" value="E_ALL"/>
5052
<env name="DB_CONNECTION" value="testing"/>
5153
</php>
5254
</phpunit>

src/Drivers/SoftDeleteBooleanDriver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

src/SoftDeletesBoolean.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/app/Models/Post.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/app/Schemas/PostSchema.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/database/factories/PostFactory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ public function definition()
3939
{
4040
return [
4141
'content' => $this->faker->paragraphs(3, true),
42-
'slug' => $this->faker->unique()->slug,
42+
'slug' => $this->faker->unique()->slug(),
4343
'title' => $this->faker->words(5, true),
4444
];
4545
}

tests/database/migrations/2021_04_23_1032_create_post_table.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/lib/Acceptance/Test.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -134,7 +134,7 @@ public function testItForceDeletesModel($deleted): void
134134

135135
$this->schema->repository()->delete((string) $post->getRouteKey());
136136

137-
$this->assertDeleted($post);
137+
$this->assertModelMissing($post);
138138
$this->assertTrue($forceDeleted);
139139
}
140140

tests/lib/Acceptance/TestCase.php

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -20,13 +20,16 @@
2020
namespace LaravelJsonApi\BooleanSoftDeletes\Tests\Acceptance;
2121

2222
use App\Schemas\PostSchema;
23+
use Illuminate\Foundation\Testing\Concerns\InteractsWithDeprecationHandling;
2324
use LaravelJsonApi\Contracts\Schema\Container as SchemaContainerContract;
2425
use LaravelJsonApi\Contracts\Server\Server;
2526
use LaravelJsonApi\Core\Schema\Container as SchemaContainer;
27+
use LaravelJsonApi\Core\Support\ContainerResolver;
2628
use Orchestra\Testbench\TestCase as BaseTestCase;
2729

2830
class TestCase extends BaseTestCase
2931
{
32+
use InteractsWithDeprecationHandling;
3033

3134
/**
3235
* @return void
@@ -35,14 +38,22 @@ protected function setUp(): void
3538
{
3639
parent::setUp();
3740

41+
$this->withoutDeprecationHandling();
42+
3843
$this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
3944

40-
$this->app->singleton(
41-
SchemaContainerContract::class,
42-
fn($container) => new SchemaContainer($container, $container->make(Server::class), [
45+
// @TODO can simplify this when only supporting laravel-json-api/eloquent:^2.0
46+
$this->app->singleton(SchemaContainerContract::class, static function ($container) {
47+
if (class_exists(ContainerResolver::class)) {
48+
$resolver = new ContainerResolver(static fn() => $container);
49+
} else {
50+
$resolver = $container;
51+
}
52+
53+
return new SchemaContainer($resolver, $container->make(Server::class), [
4354
PostSchema::class,
44-
]),
45-
);
55+
]);
56+
});
4657

4758
$this->app->singleton(Server::class, function () {
4859
$server = $this->createMock(Server::class);

0 commit comments

Comments
 (0)