Tighten service test signal
This commit is contained in:
@@ -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
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user