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.
21 lines
787 B
PHP
21 lines
787 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
namespace App\Tests;
|
|
use App\Http\{Request, Response};
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class HttpTest extends TestCase
|
|
{
|
|
public function testRequestJsonAndHeaderCaseInsensitive(): void {
|
|
$r = new Request('POST', '/api/events', ['X-Nonce' => 'n1'], '{"a":1}', [], []);
|
|
$this->assertSame('POST', $r->method());
|
|
$this->assertSame('n1', $r->header('x-nonce'));
|
|
$this->assertSame(['a' => 1], $r->json());
|
|
}
|
|
public function testResponseJson(): void {
|
|
$res = Response::json(['ok' => true], 201);
|
|
$this->assertSame(201, $res->status());
|
|
$this->assertStringContainsString('application/json', $res->headers()['Content-Type']);
|
|
$this->assertSame('{"ok":true}', $res->body());
|
|
}
|
|
}
|