mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Used PHPUnit mocks in RoleResolverTest instead of prophezy
This commit is contained in:
@@ -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',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user