move_detect/server/tests/ImageProcessorTest.php
유창욱 3f2823a764 refactor: rename cloud/ to server/ (cafe24 is web hosting, not cloud)
The PHP app runs on Cafe24 shared web hosting -- calling it 'cloud'
was misleading. Renames the directory, the edge client module, and
every doc/script/identifier that used the term.

- cloud/ -> server/ (incl. server/deploy/build_cafe24_package.sh paths)
- edge/cloudclient.py -> edge/serverclient.py, CloudClient -> ServerClient
- cloud/docs/cloud-deploy.md -> server/docs/server-deploy.md
- CLOUD_* env/config keys -> SERVER_*
- tests renamed to match

Tests: PHP 109 pass (4 skipped), pytest 167 pass. dist/ regenerated.
2026-07-20 11:30:52 +09:00

28 lines
1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Tests;
use App\Ingest\ImageProcessor;
use PHPUnit\Framework\TestCase;
final class ImageProcessorTest extends TestCase
{
private function tinyJpegBase64(): string {
$im = imagecreatetruecolor(8, 8);
ob_start(); imagejpeg($im); $bytes = ob_get_clean();
return base64_encode($bytes);
}
public function testReencodeProducesJpeg(): void {
$r = ImageProcessor::reencode($this->tinyJpegBase64());
$this->assertTrue($r['ok']);
$this->assertSame("\xFF\xD8", substr($r['bytes'], 0, 2)); // JPEG magic
$this->assertSame(32, strlen($r['uuid']));
$this->assertSame(64, strlen($r['hash']));
}
public function testRejectsNonImage(): void {
$r = ImageProcessor::reencode(base64_encode("not an image <?php echo 1; ?>"));
$this->assertFalse($r['ok']);
}
public function testRejectsBadBase64(): void {
$this->assertFalse(ImageProcessor::reencode('%%%not-base64%%%')['ok']);
}
}