Fix tenant SSO status mode and refactor status UI tiles

This commit is contained in:
2026-03-12 10:01:24 +01:00
parent e9f73bc96a
commit 24a6b79f7a
8 changed files with 190 additions and 37 deletions

View File

@@ -159,6 +159,48 @@ class TenantSsoServiceTest extends TestCase
$this->assertSame('sso_disabled', $result['microsoft_reason']);
}
public function testBuildMicrosoftUiStateReturnsLocalOnlyPasswordModeWhenSsoDisabled(): void
{
$repository = $this->createMock(TenantMicrosoftAuthRepositoryInterface::class);
$repository->method('findByTenantId')->willReturn([
'enabled' => 0,
'enforce_microsoft_login' => 1,
]);
$service = $this->newService($repository);
$result = $service->buildMicrosoftUiState(5);
$this->assertSame('local_only', $result['password_mode']);
}
public function testBuildMicrosoftUiStateReturnsLocalAndMicrosoftPasswordModeWhenSsoEnabledWithoutEnforcement(): void
{
$repository = $this->createMock(TenantMicrosoftAuthRepositoryInterface::class);
$repository->method('findByTenantId')->willReturn([
'enabled' => 1,
'enforce_microsoft_login' => 0,
]);
$service = $this->newService($repository);
$result = $service->buildMicrosoftUiState(5);
$this->assertSame('local_and_microsoft', $result['password_mode']);
}
public function testBuildMicrosoftUiStateReturnsMicrosoftOnlyPasswordModeWhenEnforced(): void
{
$repository = $this->createMock(TenantMicrosoftAuthRepositoryInterface::class);
$repository->method('findByTenantId')->willReturn([
'enabled' => 1,
'enforce_microsoft_login' => 1,
]);
$service = $this->newService($repository);
$result = $service->buildMicrosoftUiState(5);
$this->assertSame('microsoft_only', $result['password_mode']);
}
public function testResolveTenantLoginMethodsReturnsMicrosoftOnlyWhenEnforcedAndConfigured(): void
{
$tenantGateway = $this->createMock(AuthTenantGateway::class);