add test batches
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Api\V1\FullSurface;
|
||||
|
||||
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
|
||||
|
||||
class ApiLocalizationAndLocaleFallbackContractTest extends FullSurfaceE2EContractCase
|
||||
{
|
||||
public function test_supported_and_unsupported_accept_language_headers_stay_controlled(): void
|
||||
{
|
||||
$locales = ['en', 'ar', 'fr-CA', 'zz-ZZ', str_repeat('x', 256)];
|
||||
|
||||
foreach ($this->apiRoutesContainingAny(['auth/me', 'dashboard', 'profile', 'attendance', 'finance', 'settings']) as $route) {
|
||||
if ($this->primaryMethod($route) !== 'GET') {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($locales as $locale) {
|
||||
$response = $this->actingAs($this->actorFor($route->uri()), 'api')
|
||||
->withHeader('Accept-Language', $locale)
|
||||
->getJson($this->materializePath($route->uri()));
|
||||
|
||||
$this->assertControlled($response, 'GET', $route->uri());
|
||||
$this->assertStringNotContainsString('translation missing', strtolower($response->getContent()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function test_timezone_parameters_do_not_corrupt_attendance_or_finance_queries(): void
|
||||
{
|
||||
$timezones = ['America/New_York', 'UTC', 'Asia/Riyadh', 'Invalid/Timezone', str_repeat('A', 128)];
|
||||
|
||||
foreach ($this->apiRoutesContainingAny(['attendance', 'calendar', 'finance', 'payments', 'reports']) as $route) {
|
||||
if ($this->primaryMethod($route) !== 'GET') {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($timezones as $timezone) {
|
||||
$response = $this->requestAs($this->actorFor($route->uri()), 'GET', $route->uri(), [
|
||||
'timezone' => $timezone,
|
||||
'date' => '2025-10-05',
|
||||
]);
|
||||
|
||||
$this->assertStatusIn($response, [200, 204, 400, 403, 404, 409, 422], "Timezone {$timezone} on {$route->uri()}");
|
||||
$this->assertStringNotContainsString('date_default_timezone', $response->getContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user