From 0c4b10ad84491316a7f446c4ede3a9963b85153d Mon Sep 17 00:00:00 2001 From: eparusov Date: Mon, 16 Dec 2024 14:48:52 +0300 Subject: [PATCH] fix: resource generator --- stubs/collection_resource.blade.php | 2 +- stubs/test.blade.php | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/stubs/collection_resource.blade.php b/stubs/collection_resource.blade.php index 79c29639..eb060d99 100644 --- a/stubs/collection_resource.blade.php +++ b/stubs/collection_resource.blade.php @@ -1,4 +1,4 @@ -namespace {{$namespace}}{{$singular_name}}; +namespace {{$namespace}}\{{$singular_name}}; use Illuminate\Http\Resources\Json\ResourceCollection; diff --git a/stubs/test.blade.php b/stubs/test.blade.php index ad74a9d9..2562121a 100644 --- a/stubs/test.blade.php +++ b/stubs/test.blade.php @@ -47,7 +47,8 @@ public function testCreate() $response->assertCreated(); - $this->assertEqualsFixture('create_{{\Illuminate\Support\Str::snake($entity)}}_response.json', $response->json()); + // TODO: Need to remove last argument after first successful start + $this->assertEqualsFixture('create_{{\Illuminate\Support\Str::snake($entity)}}_response.json', $response->json(), true); // TODO: Need to remove last argument after first successful start self::${{\Illuminate\Support\Str::camel($entity)}}State->assertChangesEqualsFixture('create_{{\Illuminate\Support\Str::snake($entity)}}_state.json', true); @@ -206,5 +207,12 @@ public function testSearch(array $filter, string $fixture) $this->assertEqualsFixture($fixture, $response->json()); } + + public function testSearchNoAuth() + { + $response = $this->json('get', '/{{$entities}}'); + + $response->assertUnauthorized(); + } @endif }