chore(tests): reorganize feature suites and expand team auth coverage

This commit is contained in:
Andras Bacsai committed 2026-02-26 07:13:19 +01:00
1 parent 34d8499a0c
commit 347af07a79
70 files changed
+125 -294

No files matched your search

@@ -0,0 +1,38 @@
<?php
namespace Tests\Feature\Helpers;
use Tests\TestCase;
class Utf8HandlingTest extends TestCase
{
public function test_sanitize_utf8_text_handles_malformed_utf8()
{
// Test with valid UTF-8
$validUtf8 = 'Hello World! 🚀';
$this->assertEquals($validUtf8, sanitize_utf8_text($validUtf8));
// Test with empty string
$this->assertEquals('', sanitize_utf8_text(''));
// Test with malformed UTF-8 (binary data)
$malformedUtf8 = "Hello\x80\x81\x82World";
$sanitized = sanitize_utf8_text($malformedUtf8);
$this->assertTrue(mb_check_encoding($sanitized, 'UTF-8'));
// Test that JSON encoding works after sanitization
$testArray = ['output' => $sanitized];
$this->assertIsString(json_encode($testArray, JSON_THROW_ON_ERROR));
}
public function test_remove_iip_handles_malformed_utf8()
{
// Test with malformed UTF-8 in command output
$malformedOutput = "Processing image\x80\x81file.webp";
$cleaned = remove_iip($malformedOutput);
$this->assertTrue(mb_check_encoding($cleaned, 'UTF-8'));
// Test that JSON encoding works after cleaning
$this->assertIsString(json_encode(['output' => $cleaned], JSON_THROW_ON_ERROR));
}
}