mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-26 08:35:00 +00:00
fix cs
This commit is contained in:
@@ -45,6 +45,29 @@ final class AuthorizationHelperTest extends KernelTestCase
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testGetParentRoles()
|
||||
{
|
||||
$parentRoles = $this->getAuthorizationHelper()
|
||||
->getParentRoles('CHILL_INHERITED_ROLE_1');
|
||||
|
||||
$this->assertContains(
|
||||
'CHILL_MASTER_ROLE',
|
||||
$parentRoles,
|
||||
'Assert that `CHILL_MASTER_ROLE` is a parent of `CHILL_INHERITED_ROLE_1`'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProvider_getReachableCenters
|
||||
*/
|
||||
public function testGetReachableCenters(mixed $test, mixed $result, mixed $msg)
|
||||
{
|
||||
$this->assertEquals($test, $result, $msg);
|
||||
}
|
||||
|
||||
public static function dataProvider_getReachableCenters()
|
||||
{
|
||||
self::bootKernel();
|
||||
@@ -143,6 +166,30 @@ final class AuthorizationHelperTest extends KernelTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProvider_getReachableScopes
|
||||
*
|
||||
* @param bool $expectedResult
|
||||
* @param string $message
|
||||
*/
|
||||
public function testGetReachableScopes(
|
||||
$expectedResult,
|
||||
Scope $testedScope,
|
||||
User $user,
|
||||
string $role,
|
||||
Center $center,
|
||||
$message,
|
||||
) {
|
||||
$reachableScopes = $this->getAuthorizationHelper()
|
||||
->getReachableScopes($user, $role, $center);
|
||||
|
||||
$this->assertEquals(
|
||||
$expectedResult,
|
||||
\in_array($testedScope, $reachableScopes, true),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
public static function dataProvider_getReachableScopes()
|
||||
{
|
||||
$centerA = self::prepareCenter(1, 'center A');
|
||||
@@ -198,53 +245,6 @@ final class AuthorizationHelperTest extends KernelTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testGetParentRoles()
|
||||
{
|
||||
$parentRoles = $this->getAuthorizationHelper()
|
||||
->getParentRoles('CHILL_INHERITED_ROLE_1');
|
||||
|
||||
$this->assertContains(
|
||||
'CHILL_MASTER_ROLE',
|
||||
$parentRoles,
|
||||
'Assert that `CHILL_MASTER_ROLE` is a parent of `CHILL_INHERITED_ROLE_1`'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProvider_getReachableCenters
|
||||
*/
|
||||
public function testGetReachableCenters(mixed $test, mixed $result, mixed $msg)
|
||||
{
|
||||
$this->assertEquals($test, $result, $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProvider_getReachableScopes
|
||||
*
|
||||
* @param bool $expectedResult
|
||||
* @param string $message
|
||||
*/
|
||||
public function testGetReachableScopes(
|
||||
$expectedResult,
|
||||
Scope $testedScope,
|
||||
User $user,
|
||||
string $role,
|
||||
Center $center,
|
||||
$message,
|
||||
) {
|
||||
$reachableScopes = $this->getAuthorizationHelper()
|
||||
->getReachableScopes($user, $role, $center);
|
||||
|
||||
$this->assertEquals(
|
||||
$expectedResult,
|
||||
\in_array($testedScope, $reachableScopes, true),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
public function testtestUserHasAccessUserShouldHaveAccessEntityWithScope()
|
||||
{
|
||||
$center = $this->prepareCenter(1, 'center');
|
||||
|
Reference in New Issue
Block a user