34 lines
1.4 KiB
PHP
34 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Api\V1\FullSurface;
|
|
|
|
use Tests\Feature\Api\V1\FullSurface\Support\FullSurfaceE2EContractCase;
|
|
|
|
class ApiBatch15LocalizationContentDirectionAndEncodingContractTest extends FullSurfaceE2EContractCase
|
|
{
|
|
public function test_batch15_rtl_unicode_and_encoding_payloads_remain_controlled_across_text_routes(): void
|
|
{
|
|
$routes = $this->apiRoutesContainingAny(['message', 'contact', 'support', 'notification', 'student', 'parent', 'settings', 'certificate']);
|
|
$text = "اختبار עברית café e\u{0301} \u{202E}evil.pdf 😬";
|
|
|
|
foreach (array_slice($routes, 0, 45) as $route) {
|
|
$method = $this->primaryMethod($route);
|
|
if (! in_array($method, ['POST', 'PUT', 'PATCH'], true)) {
|
|
continue;
|
|
}
|
|
|
|
$response = $this->withHeader('Accept-Language', 'ar,en;q=0.7')
|
|
->requestAs($this->actorFor($route->uri()), $method, $route->uri(), $this->payloadFor($method, $route->uri()) + [
|
|
'name' => $text,
|
|
'title' => $text,
|
|
'message' => $text,
|
|
'notes' => $text,
|
|
'description' => $text,
|
|
]);
|
|
|
|
$this->assertControlled($response, $method, $route->uri());
|
|
$this->assertStringNotContainsString('malformed utf-8', strtolower($response->getContent()));
|
|
}
|
|
}
|
|
}
|