Skip to content

Commit c17b2a7

Browse files
gabrielmpetrescugabrielmpetrescu
authored andcommitted
unit tests
1 parent 190e70e commit c17b2a7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/Feature/Filters/AdvancedFilterTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Binaryk\LaravelRestify\Tests\Fixtures\User\UserRepository;
1515
use Binaryk\LaravelRestify\Tests\IntegrationTestCase;
1616
use Illuminate\Testing\Fluent\AssertableJson;
17+
use JsonException;
1718

1819
class AdvancedFilterTest extends IntegrationTestCase
1920
{
@@ -288,4 +289,17 @@ public function test_index_with_null_filters_query_param_returns_all_results():
288289
->assertOk()
289290
->assertJsonCount(3, 'data');
290291
}
292+
293+
public function test_index_with_invalid_json_filters_throws_json_exception(): void
294+
{
295+
$this->withoutExceptionHandling();
296+
297+
$this->expectException(JsonException::class);
298+
299+
$filters = base64_encode('invalid-json{');
300+
301+
$this->getJson(PostRepository::route(query: [
302+
'filters' => $filters,
303+
]));
304+
}
291305
}

0 commit comments

Comments
 (0)