refactor(tests): remove redundant tests and fix assertion style

Remove subset/duplicate architecture tests already covered by broader
checks, and replace assertTrue(true) with self::addToAssertionCount(1)
for explicit no-exception-thrown intent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 18:46:49 +01:00
parent cb5f7037b2
commit c609753570
19 changed files with 111 additions and 284 deletions

View File

@@ -6,6 +6,8 @@ use MintyPHP\Service\Tenant\TenantScopeService;
class DepartmentAuthorizationPolicy implements AuthorizationPolicyInterface
{
use AuthorizationPolicyContextTrait;
public const ABILITY_ADMIN_DEPARTMENTS_VIEW = 'admin.departments.view';
public const ABILITY_ADMIN_DEPARTMENTS_CREATE = 'admin.departments.create';
public const ABILITY_ADMIN_DEPARTMENTS_EDIT_CONTEXT = 'admin.departments.edit.context';
@@ -138,24 +140,8 @@ class DepartmentAuthorizationPolicy implements AuthorizationPolicyInterface
return AuthorizationDecision::allow();
}
private function actorUserId(array $context): int
{
return (int) ($context['actor_user_id'] ?? 0);
}
private function targetDepartmentId(array $context): int
{
return (int) ($context['target_department_id'] ?? 0);
}
private function hasPermission(int $userId, string $permissionKey): bool
{
return $userId > 0 && $this->permissionService->userHas($userId, $permissionKey);
}
private function capabilitiesFromDecision(AuthorizationDecision $decision): array
{
$capabilities = $decision->attribute('capabilities', []);
return is_array($capabilities) ? $capabilities : [];
}
}