Skip to content

Commit

Permalink
fix: method test filter entity in nova template
Browse files Browse the repository at this point in the history
  • Loading branch information
t0xas committed May 31, 2024
1 parent 3447294 commit e11fb29
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
FROM webdevops/php-nginx-dev:7.4

RUN wget -O "/usr/local/bin/go-replace" "https://github.com/webdevops/goreplace/releases/download/1.1.2/gr-arm64-linux" \
&& chmod +x "/usr/local/bin/go-replace" \
&& "/usr/local/bin/go-replace" --version
9 changes: 0 additions & 9 deletions tests/Support/NovaTestMockTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,4 @@ public function mockFilesystem(): void

vfsStream::create($structure);
}

public function novaSearchParams(array $filters, string $search = '', int $perPage = 25): array
{
return [
'search' => $search,
'filters' => base64_encode(json_encode($filters)),
'perPage' => $perPage
];
}
}
14 changes: 6 additions & 8 deletions tests/fixtures/NovaTestGeneratorTest/created_resource_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,14 @@ public function getPostFiltersData(): array
{
return [
[
'filters' => [
'TextField:description_field' => ['search term'],
'request' => [
'TextField:description_field' => $this->novaSearchParams(['search term']),
],
'response_fixture' => 'filter_post_by_text_field.json',
],
[
'filters' => [
'RonasIT\Support\Tests\Support\CreatedAtFilter' => ['search term'],
'request' => [
'RonasIT\Support\Tests\Support\CreatedAtFilter' => $this->novaSearchParams(['search term']),
],
'response_fixture' => 'filter_post_by_created_at_filter.json',
],
Expand All @@ -268,11 +268,9 @@ public function getPostFiltersData(): array
/**
* @dataProvider getPostFiltersData
*/
public function testFilterPost(array $filters, string $responseFixture): void
public function testFilterPost(array $request, string $responseFixture): void
{
$response = $this->actingAs(self::$user, 'web')->json('get', '/nova-api/post-resources', [
'filters' => base64_encode(json_encode($filters))
]);
$response = $this->actingAs(self::$user, 'web')->json('get', '/nova-api/post-resources', $request);

$response->assertOk();

Expand Down

0 comments on commit e11fb29

Please sign in to comment.