From ae74fc32516357842e3ae5d33aa737b77cfb29d9 Mon Sep 17 00:00:00 2001 From: fs Date: Thu, 19 Mar 2026 20:35:15 +0100 Subject: [PATCH] Stabilize service suite hygiene --- tests/Service/Auth/AuthServiceTest.php | 25 +++++++++++++++++++ tests/Service/Mail/MailServiceTest.php | 2 +- .../Service/User/UserLifecycleServiceTest.php | 4 +-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/tests/Service/Auth/AuthServiceTest.php b/tests/Service/Auth/AuthServiceTest.php index bc8f0b9..97802b7 100644 --- a/tests/Service/Auth/AuthServiceTest.php +++ b/tests/Service/Auth/AuthServiceTest.php @@ -18,6 +18,31 @@ use PHPUnit\Framework\TestCase; class AuthServiceTest 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(); + } + // --------------------------------------------------------------- // canLoginToTenant // --------------------------------------------------------------- diff --git a/tests/Service/Mail/MailServiceTest.php b/tests/Service/Mail/MailServiceTest.php index 788fdcc..66bef22 100644 --- a/tests/Service/Mail/MailServiceTest.php +++ b/tests/Service/Mail/MailServiceTest.php @@ -123,7 +123,7 @@ class MailServiceTest extends TestCase ->method('markFailed') ->with( $this->identicalTo(5), - $this->isType('string'), + $this->isString(), ); $service = $this->newService(mailLogRepository: $mailLogRepository); diff --git a/tests/Service/User/UserLifecycleServiceTest.php b/tests/Service/User/UserLifecycleServiceTest.php index 10ffb77..963b560 100644 --- a/tests/Service/User/UserLifecycleServiceTest.php +++ b/tests/Service/User/UserLifecycleServiceTest.php @@ -219,9 +219,9 @@ class UserLifecycleServiceTest extends TestCase $this->auditService->expects($this->once()) ->method('logDeactivate') ->with( - $this->isType('string'), + $this->isString(), 'manual', - $this->isType('array'), + $this->isArray(), 99, $user7, 'success',