refactor(arch): enforce gateway compliance and remove service-wrapping gateways

This commit is contained in:
2026-03-13 11:31:33 +01:00
parent 082fa4c9a5
commit 892da0048d
96 changed files with 1117 additions and 1060 deletions

View File

@@ -5,13 +5,13 @@ namespace MintyPHP\Tests\Service\Auth;
use MintyPHP\Http\SessionStoreInterface;
use MintyPHP\Repository\User\UserReadRepositoryInterface;
use MintyPHP\Repository\User\UserWriteRepositoryInterface;
use MintyPHP\Service\Access\PermissionService;
use MintyPHP\Service\Audit\SystemAuditService;
use MintyPHP\Service\Auth\AuthPermissionGateway;
use MintyPHP\Service\Auth\AuthService;
use MintyPHP\Service\Auth\AuthSessionTenantContextService;
use MintyPHP\Service\Auth\AuthTenantSsoGateway;
use MintyPHP\Service\Auth\EmailVerificationService;
use MintyPHP\Service\Auth\RememberMeService;
use MintyPHP\Service\Auth\TenantSsoService;
use MintyPHP\Service\User\UserAccountService;
use MintyPHP\Service\User\UserTenantContextService;
use PHPUnit\Framework\TestCase;
@@ -135,15 +135,15 @@ class AuthServiceTest extends TestCase
$userRead->method('findAuthzSnapshot')->willReturn(['active' => 1, 'authz_version' => 3]);
$userRead->method('find')->willReturn(['id' => 5, 'active' => 1, 'authz_version' => 3]);
$permGateway = $this->createMock(AuthPermissionGateway::class);
$permGateway->expects($this->once())->method('warmUserPermissions')->with(5, true);
$permService = $this->createMock(PermissionService::class);
$permService->expects($this->once())->method('getUserPermissions')->with(5, true);
$tenantCtxService = $this->createMock(AuthSessionTenantContextService::class);
$tenantCtxService->expects($this->once())->method('hydrateForUser')->with(5);
$service = $this->newService(
userReadRepository: $userRead,
permissionGateway: $permGateway,
permissionService: $permService,
authSessionTenantContextService: $tenantCtxService,
sessionStore: $session
);
@@ -234,8 +234,8 @@ class AuthServiceTest extends TestCase
['no_active_tenant', false, false],
]);
$permGateway = $this->createMock(AuthPermissionGateway::class);
$permGateway->expects($this->once())->method('warmUserPermissions')->with(5, true);
$permService = $this->createMock(PermissionService::class);
$permService->expects($this->once())->method('getUserPermissions')->with(5, true);
$tenantCtxService = $this->createMock(AuthSessionTenantContextService::class);
$tenantCtxService->expects($this->once())->method('hydrateForUser')->with(5);
@@ -247,7 +247,7 @@ class AuthServiceTest extends TestCase
$service = $this->newService(
userReadRepository: $userRead,
userWriteRepository: $userWrite,
permissionGateway: $permGateway,
permissionService: $permService,
authSessionTenantContextService: $tenantCtxService,
systemAuditService: $audit,
sessionStore: $session
@@ -434,8 +434,8 @@ class AuthServiceTest extends TestCase
?UserTenantContextService $userTenantContextService = null,
?RememberMeService $rememberMeService = null,
?EmailVerificationService $emailVerificationService = null,
?AuthPermissionGateway $permissionGateway = null,
?AuthTenantSsoGateway $tenantSsoGateway = null,
?PermissionService $permissionService = null,
?TenantSsoService $tenantSsoService = null,
?AuthSessionTenantContextService $authSessionTenantContextService = null,
?SystemAuditService $systemAuditService = null,
?SessionStoreInterface $sessionStore = null
@@ -447,8 +447,8 @@ class AuthServiceTest extends TestCase
$userTenantContextService ?? $this->createMock(UserTenantContextService::class),
$rememberMeService ?? $this->createMock(RememberMeService::class),
$emailVerificationService ?? $this->createMock(EmailVerificationService::class),
$permissionGateway ?? $this->createMock(AuthPermissionGateway::class),
$tenantSsoGateway ?? $this->createMock(AuthTenantSsoGateway::class),
$permissionService ?? $this->createMock(PermissionService::class),
$tenantSsoService ?? $this->createMock(TenantSsoService::class),
$authSessionTenantContextService ?? $this->createMock(AuthSessionTenantContextService::class),
$systemAuditService ?? $this->createMock(SystemAuditService::class),
$sessionStore ?? $this->createMock(SessionStoreInterface::class)