update controllers logic

This commit is contained in:
root
2026-04-23 00:04:35 -04:00
parent 1977a513df
commit ca4ba272fc
353 changed files with 13402 additions and 1301 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace Tests\Unit;
use App\Services\ApplicationUrlService;
use App\Services\Auth\AuthSessionService;
use PHPUnit\Framework\TestCase;
class AuthSessionServiceTest extends TestCase
{
private AuthSessionService $svc;
protected function setUp(): void
{
parent::setUp();
$urls = $this->createMock(ApplicationUrlService::class);
$urls->method('docsHomeUrl')->willReturn('http://example.org');
$this->svc = new AuthSessionService($urls);
}
public function test_sanitize_redirect_relative(): void
{
$this->assertSame('/dashboard', $this->svc->sanitizeRedirectTarget('/dashboard'));
$this->assertSame('/dash?q=1', $this->svc->sanitizeRedirectTarget('/dash?q=1'));
}
public function test_sanitize_redirect_empty(): void
{
$this->assertNull($this->svc->sanitizeRedirectTarget(''));
$this->assertNull($this->svc->sanitizeRedirectTarget(' '));
}
public function test_sanitize_rejects_protocol_relative(): void
{
$this->assertNull($this->svc->sanitizeRedirectTarget('//evil.example/path'));
}
}