mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-17 16:40:31 +00:00
✨ Handle non-numeric values in selected filter for Country API and add corresponding tests
- 🔧 Refactor `CountryController` to safely process non-numeric values in `selected` query parameter using `array_filter`. - 🧪 Add feature test to ensure API does not crash when `selected` includes non-numeric codes.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Country;
|
||||
|
||||
it('does not crash when selected contains non-numeric codes', function () {
|
||||
Country::factory()->create(['code' => 'CH']);
|
||||
|
||||
$response = $this->getJson('/api/countries?'.http_build_query([
|
||||
'selected' => ['CH', 'de', '1'],
|
||||
]));
|
||||
|
||||
$response->assertSuccessful();
|
||||
});
|
||||
Reference in New Issue
Block a user