Used PHPUnit mocks in RoleResolverTest instead of prophezy

This commit is contained in:
Alejandro Celaya
2022-10-12 12:47:58 +02:00
parent b59cbeceac
commit bcd5d2848d
7 changed files with 61 additions and 47 deletions

View File

@@ -17,6 +17,22 @@ enum Role: string
case AUTHORED_SHORT_URLS = 'AUTHORED_SHORT_URLS';
case DOMAIN_SPECIFIC = 'DOMAIN_SPECIFIC';
public function toFriendlyName(): string
{
return match ($this) {
self::AUTHORED_SHORT_URLS => 'Author only',
self::DOMAIN_SPECIFIC => 'Domain only',
};
}
public function paramName(): string
{
return match ($this) {
self::AUTHORED_SHORT_URLS => 'author-only',
self::DOMAIN_SPECIFIC => 'domain-only',
};
}
public static function toSpec(ApiKeyRole $role, ?string $context = null): Specification
{
return match ($role->role()) {
@@ -42,12 +58,4 @@ enum Role: string
{
return $meta['authority'] ?? '';
}
public static function toFriendlyName(Role $role): string
{
return match ($role) {
self::AUTHORED_SHORT_URLS => 'Author only',
self::DOMAIN_SPECIFIC => 'Domain only',
};
}
}