move_detect/server/tests/SiteScopeTest.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

31 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Tests;
use App\Security\SiteScope;
use PHPUnit\Framework\TestCase;
final class SiteScopeTest extends TestCase
{
public function testNullScopeIsGlobal(): void
{
$this->assertTrue(SiteScope::isGlobal(null));
$this->assertTrue(SiteScope::allows(null, 'factory-a')); // a global operator sees every site
$this->assertTrue(SiteScope::allows(null, null));
}
public function testEmptyStringScopeIsNotGlobal(): void
{
// A blank scope (an accidental '') must fail CLOSED — never be silently promoted to
// global access the way it was before this fix.
$this->assertFalse(SiteScope::isGlobal(''));
$this->assertFalse(SiteScope::allows('', 'factory-a'));
$this->assertFalse(SiteScope::allows('', null));
}
public function testScopedCallerSeesOnlyItsExactSite(): void
{
$this->assertTrue(SiteScope::allows('factory-a', 'factory-a'));
$this->assertFalse(SiteScope::allows('factory-a', 'factory-b'));
$this->assertFalse(SiteScope::allows('factory-a', null)); // an unscoped row is hidden from a scoped caller
}
}