Skip to content

Commit 822e512

Browse files
authored
Merge pull request #84 from RonasIT/fix-template-for-generarte-nova-tests
Fix template for generarte nova tests
2 parents 5e1b91a + 1fedc1d commit 822e512

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

stubs/nova_test.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function setUp(): void
1616
{
1717
parent::setUp();
1818

19-
self::$user = User::find(1);
19+
self::$user ??= User::find(1);
2020
self::${{$lower_entity}}State ??= new ModelTestState({{$entity}}::class);
2121

2222
$this->skipDocumentationCollecting();
@@ -53,7 +53,7 @@ public function testCreateNoAuth(): void
5353
@endif
5454

5555
self::${{$lower_entity}}State->assertNotChanged();
56-
}
56+
}
5757

5858
public function testCreateValidationError(): void
5959
{
@@ -318,7 +318,7 @@ public function get{{$entity}}FiltersData(): array
318318
@foreach($filters as $filter)
319319
[
320320
'filters' => [
321-
'{{$filter['name']}}' => 'search term',
321+
'{{$filter['name']}}' => ['search term'],
322322
],
323323
'response_fixture' => 'filter_{{$lower_entity}}_by_{{$filter['fixture_name']}}.json',
324324
],

tests/fixtures/NovaTestGeneratorTest/created_resource_test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function setUp(): void
1414
{
1515
parent::setUp();
1616

17-
self::$user = User::find(1);
17+
self::$user ??= User::find(1);
1818
self::$postState ??= new ModelTestState(Post::class);
1919

2020
$this->skipDocumentationCollecting();
@@ -43,7 +43,7 @@ public function testCreateNoAuth(): void
4343
$response->assertUnauthorized();
4444

4545
self::$postState->assertNotChanged();
46-
}
46+
}
4747

4848
public function testCreateValidationError(): void
4949
{
@@ -252,13 +252,13 @@ public function getPostFiltersData(): array
252252
return [
253253
[
254254
'filters' => [
255-
'TextField:description_field' => 'search term',
255+
'TextField:description_field' => ['search term'],
256256
],
257257
'response_fixture' => 'filter_post_by_text_field.json',
258258
],
259259
[
260260
'filters' => [
261-
'RonasIT\Support\Tests\Support\CreatedAtFilter' => 'search term',
261+
'RonasIT\Support\Tests\Support\CreatedAtFilter' => ['search term'],
262262
],
263263
'response_fixture' => 'filter_post_by_created_at_filter.json',
264264
],

0 commit comments

Comments
 (0)