@@ -13,21 +13,21 @@ class Nova{{$entity}}Test extends TestCase
1313 use NovaTestTrait;
1414
1515 protected static User $user;
16- protected static ModelTestState ${{ $lower_entity } } State;
16+ protected static ModelTestState ${{ $dromedary_entity } } State;
1717
1818 public function setUp(): void
1919 {
2020 parent::setUp();
2121
2222 self::$user ??= User::find(1);
23- self::${{ $lower_entity } } State ??= new ModelTestState({{ $entity } } ::class);
23+ self::${{ $dromedary_entity } } State ??= new ModelTestState({{ $entity } } ::class);
2424
2525 $this->skipDocumentationCollecting();
2626 }
2727
2828 public function testCreate(): void
2929 {
30- $data = $this->getJsonFixture('create_{{ $lower_entity } } _request.json');
30+ $data = $this->getJsonFixture('create_{{ $snake_entity } } _request.json');
3131
3232 $response = $this->actingAs(self::$user, 'web')->json('post', '/nova-api/{{ $url_path } } ', $data);
3333
@@ -37,25 +37,23 @@ public function testCreate(): void
3737 $response->assertCreated();
3838@endif
3939
40- $this->assertEqualsFixture('create_{{ $lower_entity } } _response.json', $response->json());
40+ $this->assertEqualsFixture('create_{{ $snake_entity } } _response.json', $response->json());
4141
4242 // TODO: Need to remove after first successful start
43- self::${{ $lower_entity } } State->assertChangesEqualsFixture('create_{{ $lower_entities } } _state.json', true);
43+ self::${{ $dromedary_entity } } State->assertChangesEqualsFixture('create_{{ $lower_entities } } _state.json', true);
4444 }
4545
4646 public function testCreateNoAuth(): void
4747 {
48- $data = $this->getJsonFixture('create_{{ $lower_entity } } _request.json');
49-
50- $response = $this->json('post', '/nova-api/{{ $url_path } } ', $data);
48+ $response = $this->json('post', '/nova-api/{{ $url_path } } ');
5149
5250@if ($shouldUseStatus )
5351 $response->assertStatus(Response::HTTP_UNAUTHORIZED);
5452@else
5553 $response->assertUnauthorized();
5654@endif
5755
58- self::${{ $lower_entity } } State->assertNotChanged();
56+ self::${{ $dromedary_entity } } State->assertNotChanged();
5957 }
6058
6159 public function testCreateValidationError(): void
@@ -71,12 +69,12 @@ public function testCreateValidationError(): void
7169 // TODO: Need to remove after first successful start
7270 $this->assertEqualsFixture('create_validation_response.json', $response->json(), true);
7371
74- self::${{ $lower_entity } } State->assertNotChanged();
72+ self::${{ $dromedary_entity } } State->assertNotChanged();
7573 }
7674
7775 public function testUpdate(): void
7876 {
79- $data = $this->getJsonFixture('update_{{ $lower_entity } } _request.json');
77+ $data = $this->getJsonFixture('update_{{ $snake_entity } } _request.json');
8078
8179 $response = $this->actingAs(self::$user, 'web')->json('put', '/nova-api/{{ $url_path } } /1', $data);
8280
@@ -87,12 +85,12 @@ public function testUpdate(): void
8785@endif
8886
8987 // TODO: Need to remove after first successful start
90- self::${{ $lower_entity } } State->assertChangesEqualsFixture('update_{{ $lower_entities } } _state.json', true);
88+ self::${{ $dromedary_entity } } State->assertChangesEqualsFixture('update_{{ $lower_entities } } _state.json', true);
9189 }
9290
9391 public function testUpdateNotExists(): void
9492 {
95- $data = $this->getJsonFixture('update_{{ $lower_entity } } _request.json');
93+ $data = $this->getJsonFixture('update_{{ $snake_entity } } _request.json');
9694
9795 $response = $this->actingAs(self::$user, 'web')->json('put', '/nova-api/{{ $url_path } } /0', $data);
9896
@@ -105,9 +103,7 @@ public function testUpdateNotExists(): void
105103
106104 public function testUpdateNoAuth(): void
107105 {
108- $data = $this->getJsonFixture('update_{{ $lower_entity } } _request.json');
109-
110- $response = $this->json('put', '/nova-api/{{ $url_path } } /1', $data);
106+ $response = $this->json('put', '/nova-api/{{ $url_path } } /1');
111107
112108@if ($shouldUseStatus )
113109 $response->assertStatus(Response::HTTP_UNAUTHORIZED);
@@ -157,7 +153,7 @@ public function testDelete(): void
157153@endif
158154
159155 // TODO: Need to remove after first successful start
160- self::${{ $lower_entity } } State->assertChangesEqualsFixture('delete_{{ $lower_entities } } _state.json', true);
156+ self::${{ $dromedary_entity } } State->assertChangesEqualsFixture('delete_{{ $lower_entities } } _state.json', true);
161157 }
162158
163159 public function testDeleteNotExists(): void
@@ -197,7 +193,7 @@ public function testGet(): void
197193@endif
198194
199195 // TODO: Need to remove after first successful start
200- $this->assertEqualsFixture('get_{{ $lower_entity } } _response.json', $response->json(), true);
196+ $this->assertEqualsFixture('get_{{ $snake_entity } } _response.json', $response->json(), true);
201197 }
202198
203199 public function testGetNotExists(): void
@@ -224,10 +220,7 @@ public function testGetNoAuth(): void
224220
225221 public function testSearchUnauthorized(): void
226222 {
227- $response = $this->json('get', '/nova-api/{{ $url_path } } ', [
228- 'orderBy' => 'id',
229- 'orderByDirection' => 'asc'
230- ]);
223+ $response = $this->json('get', '/nova-api/{{ $url_path } } ');
231224
232225@if ($shouldUseStatus )
233226 $response->assertStatus(Response::HTTP_UNAUTHORIZED);
@@ -281,7 +274,7 @@ public function testRun{{$entity}}Actions($action, $request, ${{$lower_entities}
281274 $this->assertEmpty($response->getContent());
282275
283276 // TODO: Need to remove after first successful start
284- self::${{ $lower_entity } } State->assertChangesEqualsFixture(${{ $lower_entities } } StateFixture, true);
277+ self::${{ $dromedary_entity } } State->assertChangesEqualsFixture(${{ $lower_entities } } StateFixture, true);
285278 }
286279
287280 public function get{{ $entity } } ActionsData(): array
@@ -292,7 +285,7 @@ public function get{{$entity}}ActionsData(): array
292285 'request' => [
293286 'resources' => '1,2',
294287 ],
295- 'response_fixture' => 'get_{{ $lower_entity } } _actions_{{ $action [' fixture' ]} } .json',
288+ 'response_fixture' => 'get_{{ $snake_entity } } _actions_{{ $action [' fixture' ]} } .json',
296289 ],
297290@endforeach
298291 ];
@@ -323,7 +316,7 @@ public function get{{$entity}}FiltersData(): array
323316 'request' => [
324317 '{{ $filter [' name' ]} } ' => $this->novaSearchParams(['search term']),
325318 ],
326- 'response_fixture' => 'filter_{{ $lower_entity } } _by_{{ $filter [' fixture_name' ]} } .json',
319+ 'response_fixture' => 'filter_{{ $snake_entity } } _by_{{ $filter [' fixture_name' ]} } .json',
327320 ],
328321@endforeach
329322 ];
0 commit comments