feat: admin-managed roles and hotel codes
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Twig;
|
||||
|
||||
use App\Security\Role;
|
||||
use App\Twig\AppRuntime;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AppRuntimeMapRolesTest extends TestCase
|
||||
{
|
||||
public function testStoredRolesAreLabelledLikeInTheEditForm(): void
|
||||
{
|
||||
self::assertSame(
|
||||
['Teamer:in', 'Preisrechner'],
|
||||
$this->runtime()->mapRoles([Role::TEAMER, Role::GROUPS_MANAGER]),
|
||||
);
|
||||
}
|
||||
|
||||
public function testImplicitRoleUserIsNotListed(): void
|
||||
{
|
||||
self::assertSame(['Administration'], $this->runtime()->mapRoles(['ROLE_USER', Role::ADMIN]));
|
||||
self::assertSame([], $this->runtime()->mapRoles(['ROLE_USER']));
|
||||
}
|
||||
|
||||
public function testUnknownRoleStaysVisible(): void
|
||||
{
|
||||
self::assertSame(['ROLE_LEGACY'], $this->runtime()->mapRoles(['ROLE_LEGACY']));
|
||||
}
|
||||
|
||||
private function runtime(): AppRuntime
|
||||
{
|
||||
return (new \ReflectionClass(AppRuntime::class))->newInstanceWithoutConstructor();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user