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
662 B
PHP
21 lines
662 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
namespace App\Tests;
|
|
use App\Security\{Password, Csrf};
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class PasswordCsrfTest extends TestCase
|
|
{
|
|
public function testHashVerify(): void {
|
|
$h = Password::hash('s3cret!');
|
|
$this->assertNotSame('s3cret!', $h);
|
|
$this->assertTrue(Password::verify('s3cret!', $h));
|
|
$this->assertFalse(Password::verify('wrong', $h));
|
|
}
|
|
public function testCsrf(): void {
|
|
$t = Csrf::issue(fn() => 'abc123');
|
|
$this->assertSame('abc123', $t);
|
|
$this->assertTrue(Csrf::check($t, 'abc123'));
|
|
$this->assertFalse(Csrf::check($t, 'nope'));
|
|
}
|
|
}
|