diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d21686db..3c6d15f4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,12 +9,12 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.1, 8.2] - laravel: [10.*] + php: [8.2] + laravel: [11.*] stability: [prefer-lowest, prefer-stable] include: - - laravel: 10.* - testbench: 8.* + - laravel: 11.* + testbench: 9.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index 44965dcd..1a076b7e 100644 --- a/composer.json +++ b/composer.json @@ -18,25 +18,25 @@ } ], "require": { - "php": "^8.1", - "illuminate/contracts": "^10.0", + "php": "^8.2", + "illuminate/contracts": "^11.0", "laravel/pint": "^1.0", - "spatie/laravel-data": "dev-main", + "spatie/laravel-data": "^4.4", "spatie/laravel-package-tools": "^1.12", "spatie/once": "^3.0" }, "require-dev": { "brianium/paratest": "^7.0.6", - "doctrine/dbal": "^3.0", - "nunomaduro/collision": "^7.0", - "openai-php/laravel": "^0.3.1", - "orchestra/testbench": "^8.0", + "doctrine/dbal": "^3.0|^4.0", + "nunomaduro/collision": "^8.1", + "openai-php/laravel": "^0.8.1", + "orchestra/testbench": "^9.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^10.0", + "phpunit/phpunit": "^10.0|^11.0", "spatie/laravel-ray": "^1.9", - "vimeo/psalm": "^5.6" + "vimeo/psalm": "^6.0@dev" }, "autoload": { "files": [ @@ -75,5 +75,6 @@ } } }, - "minimum-stability": "dev" + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/src/Fields/Field.php b/src/Fields/Field.php index b5980019..5e128a56 100644 --- a/src/Fields/Field.php +++ b/src/Fields/Field.php @@ -22,7 +22,7 @@ class Field extends OrganicField implements JsonSerializable /** * The resource associated with the field. * - * @var Repository + * @var Repository */ public $repository; diff --git a/src/Repositories/Repository.php b/src/Repositories/Repository.php index dbbba033..67e06200 100644 --- a/src/Repositories/Repository.php +++ b/src/Repositories/Repository.php @@ -327,8 +327,8 @@ public function __call($method, $parameters) * However all options could be customized by passing an $options argument * * @param bool $wrap Choose the routes defined in the @routes method, should be wrapped in a group with attributes by default. - * If true then all routes will be grouped in a configuration attributes passed by restify, otherwise - * you should take care of that, by adding $router->group($attributes) in the @routes method + * If true then all routes will be grouped in a configuration attributes passed by restify, otherwise + * you should take care of that, by adding $router->group($attributes) in the @routes method */ public static function routes(Router $router, array $attributes, $wrap = true) { diff --git a/tests/Actions/FieldActionTest.php b/tests/Actions/FieldActionTest.php index 2f4fadf5..7240344d 100644 --- a/tests/Actions/FieldActionTest.php +++ b/tests/Actions/FieldActionTest.php @@ -9,10 +9,11 @@ use Binaryk\LaravelRestify\Tests\Fixtures\Post\PostRepository; use Binaryk\LaravelRestify\Tests\IntegrationTestCase; use Illuminate\Testing\Fluent\AssertableJson; +use PHPUnit\Framework\Attributes\Test; class FieldActionTest extends IntegrationTestCase { - /** * @test */ + #[Test] public function can_use_actionable_field(): void { $action = new class() extends Action @@ -52,7 +53,7 @@ public function handle(RestifyRequest $request, Post $post) } - /** @test */ + #[Test] public function can_use_actionable_field_on_bulk_store(): void { $action = new class() extends Action @@ -97,7 +98,7 @@ public function handle(RestifyRequest $request, Post $post, int $row) ); } - /** @test */ + #[Test] public function can_use_actionable_field_on_bulk_update(): void { $action = new class() extends Action diff --git a/tests/Controllers/Index/IndexRelatedFeatureTest.php b/tests/Controllers/Index/IndexRelatedFeatureTest.php index 738bc901..0ff6bbe7 100644 --- a/tests/Controllers/Index/IndexRelatedFeatureTest.php +++ b/tests/Controllers/Index/IndexRelatedFeatureTest.php @@ -24,6 +24,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Http\Request; use Illuminate\Testing\Fluent\AssertableJson; +use PHPUnit\Framework\Attributes\Test; class IndexRelatedFeatureTest extends IntegrationTestCase { @@ -197,7 +198,7 @@ public function test_repository_can_resolve_related_using_callables(): void ); } - /** * @test */ + #[Test] public function it_can_paginate_keeping_relationships(): void { PostRepository::$related = [ @@ -228,7 +229,7 @@ public function it_can_paginate_keeping_relationships(): void ); } - /** * @test */ + #[Test] public function it_will_call_fields_method_for_related(): void { UserRepository::partialMock() diff --git a/tests/Controllers/Index/NestedRepositoryControllerTest.php b/tests/Controllers/Index/NestedRepositoryControllerTest.php index e40f1a74..862da98b 100644 --- a/tests/Controllers/Index/NestedRepositoryControllerTest.php +++ b/tests/Controllers/Index/NestedRepositoryControllerTest.php @@ -12,10 +12,11 @@ use Binaryk\LaravelRestify\Tests\IntegrationTestCase; use Illuminate\Support\Facades\Gate; use Illuminate\Testing\Fluent\AssertableJson; +use PHPUnit\Framework\Attributes\Test; class NestedRepositoryControllerTest extends IntegrationTestCase { - /** * @test */ + #[Test] public function it_can_list_nested(): void { UserRepository::$related = [ @@ -33,7 +34,7 @@ public function it_can_list_nested(): void $this->getJson(UserRepository::route('1/posts'))->assertForbidden(); } - /** * @test */ + #[Test] public function it_can_show_nested_using_identifier(): void { $post = PostFactory::one([ @@ -56,7 +57,7 @@ public function it_can_show_nested_using_identifier(): void $this->getJson(UserRepository::route("$post->user_id/posts/$post->id"))->assertForbidden(); } - /** * @test */ + #[Test] public function it_can_store_nested_related(): void { UserRepository::$related = [ @@ -83,9 +84,7 @@ public function it_can_store_nested_related(): void ])->assertForbidden(); } - /** - * @test - */ + #[Test] public function it_can_update_nested_related(): void { UserRepository::$related = [ @@ -117,9 +116,7 @@ public function it_can_update_nested_related(): void ])->assertForbidden(); } - /** - * @test - */ + #[Test] public function it_can_delete_nested_related(): void { UserRepository::$related = [ @@ -139,9 +136,7 @@ public function it_can_delete_nested_related(): void $this->deleteJson(UserRepository::route("$post->user_id/posts/$post->id"))->assertForbidden(); } - /** - * @test - */ + #[Test] public function it_will_apply_policies_when_nested_requested(): void { $_SERVER['restify.post.delete'] = false; diff --git a/tests/Controllers/Index/RepositoryIndexControllerTest.php b/tests/Controllers/Index/RepositoryIndexControllerTest.php index f87ac519..4ac7e3f0 100644 --- a/tests/Controllers/Index/RepositoryIndexControllerTest.php +++ b/tests/Controllers/Index/RepositoryIndexControllerTest.php @@ -11,12 +11,13 @@ use Binaryk\LaravelRestify\Tests\IntegrationTestCase; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Testing\Fluent\AssertableJson; +use PHPUnit\Framework\Attributes\Test; class RepositoryIndexControllerTest extends IntegrationTestCase { use RefreshDatabase; - /** * @test */ + #[Test] public function it_can_paginate(): void { PostFactory::many(15); @@ -65,7 +66,7 @@ public function it_can_paginate(): void ); } - /** * @test */ + #[Test] public function it_can_search_using_query(): void { PostFactory::one([ @@ -91,7 +92,7 @@ public function it_can_search_using_query(): void ]))->assertJson(fn (AssertableJson $json) => $json->count('data', 2)->etc()); } - /** * @test */ + #[Test] public function it_can_sort_using_query(): void { PostFactory::one([ @@ -125,7 +126,7 @@ public function it_can_sort_using_query(): void ); } - /** * @test */ + #[Test] public function it_can_return_related_entity(): void { PostRepository::$related = [ diff --git a/tests/Controllers/RepositoryLoadedFromServiceProviderTest.php b/tests/Controllers/RepositoryLoadedFromServiceProviderTest.php index c6968df9..3eaf1010 100644 --- a/tests/Controllers/RepositoryLoadedFromServiceProviderTest.php +++ b/tests/Controllers/RepositoryLoadedFromServiceProviderTest.php @@ -5,6 +5,7 @@ use Binaryk\LaravelRestify\Restify; use Binaryk\LaravelRestify\Tests\Concerns\WithRepositoriesDataProvider; use Binaryk\LaravelRestify\Tests\IntegrationTestCase; +use PHPUnit\Framework\Attributes\DataProvider; class RepositoryLoadedFromServiceProviderTest extends IntegrationTestCase { @@ -22,7 +23,7 @@ protected function tearDown(): void parent::tearDown(); } - /** @dataProvider repositoryPathsFromFixtures */ + #[DataProvider('repositoryPathsFromFixtures')] public function test_repositories_can_be_loaded_with_service_provider_register_method( string $directory, string $namespace, diff --git a/tests/Unit/RepositoriesResolvedFromNamespaceTest.php b/tests/Unit/RepositoriesResolvedFromNamespaceTest.php index acfc46e0..5e07c6c8 100644 --- a/tests/Unit/RepositoriesResolvedFromNamespaceTest.php +++ b/tests/Unit/RepositoriesResolvedFromNamespaceTest.php @@ -6,6 +6,7 @@ use Binaryk\LaravelRestify\Tests\Concerns\WithRepositoriesDataProvider; use Binaryk\LaravelRestify\Tests\IntegrationTestCase; use Orchestra\Testbench\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class RepositoriesResolvedFromNamespaceTest extends IntegrationTestCase { @@ -46,9 +47,7 @@ public function test_repository_can_be_resolved_from_app_namespace(): void ); } - /** - * @dataProvider repositoryPathsFromFixtures - */ + #[DataProvider('repositoryPathsFromFixtures')] public function test_repository_can_be_resolved_from_any_namespace(string $directory, string $namespace): void { Restify::repositoriesFrom(