Tighten service test signal

This commit is contained in:
2026-03-19 20:15:48 +01:00
parent 28008c008c
commit 72c7f1b337
5 changed files with 36 additions and 133 deletions

View File

@@ -16,6 +16,31 @@ use PHPUnit\Framework\TestCase;
class RememberMeServiceTest extends TestCase
{
private array $previousSession = [];
protected function setUp(): void
{
parent::setUp();
$this->previousSession = $_SESSION ?? [];
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
$_SESSION = [];
}
protected function tearDown(): void
{
$_SESSION = $this->previousSession;
if (session_status() === PHP_SESSION_ACTIVE) {
session_write_close();
}
parent::tearDown();
}
// ---------------------------------------------------------------
// rememberUser — creates token and sets cookie
// ---------------------------------------------------------------