apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -24,10 +24,10 @@ use Chill\MainBundle\Test\PrepareScopeTrait;
use Chill\MainBundle\Test\PrepareUserTrait;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use function in_array;
/**
* @internal
*
* @coversNothing
*/
final class AuthorizationHelperTest extends KernelTestCase
@@ -78,7 +78,7 @@ final class AuthorizationHelperTest extends KernelTestCase
// without scopes
[
true,
in_array($centerA, $ah->getReachableCenters(
\in_array($centerA, $ah->getReachableCenters(
$userA,
'CHILL_ROLE_1',
null
@@ -87,7 +87,7 @@ final class AuthorizationHelperTest extends KernelTestCase
],
[
true,
in_array($centerA, $ah->getReachableCenters(
\in_array($centerA, $ah->getReachableCenters(
$userA,
'CHILL_ROLE_2',
null
@@ -96,7 +96,7 @@ final class AuthorizationHelperTest extends KernelTestCase
],
[
true,
in_array($centerB, $ah->getReachableCenters(
\in_array($centerB, $ah->getReachableCenters(
$userA,
'CHILL_ROLE_2',
null
@@ -105,7 +105,7 @@ final class AuthorizationHelperTest extends KernelTestCase
],
[
false,
in_array($centerB, $ah->getReachableCenters(
\in_array($centerB, $ah->getReachableCenters(
$userA,
'CHILL_ROLE_1',
null
@@ -115,7 +115,7 @@ final class AuthorizationHelperTest extends KernelTestCase
// with scope
[
true,
in_array($centerA, $ah->getReachableCenters(
\in_array($centerA, $ah->getReachableCenters(
$userA,
'CHILL_ROLE_1',
$scopeB
@@ -124,7 +124,7 @@ final class AuthorizationHelperTest extends KernelTestCase
],
[
false,
in_array($centerA, $ah->getReachableCenters(
\in_array($centerA, $ah->getReachableCenters(
$userA,
'CHILL_ROLE_2',
$scopeC
@@ -133,7 +133,7 @@ final class AuthorizationHelperTest extends KernelTestCase
],
[
true,
in_array($centerB, $ah->getReachableCenters(
\in_array($centerB, $ah->getReachableCenters(
$userA,
'CHILL_ROLE_2',
$scopeA
@@ -193,7 +193,7 @@ final class AuthorizationHelperTest extends KernelTestCase
'CHILL_ROLE_1',
$centerB,
'Assert that a scope not reachable is not found within accessible scopes.'
. ' Trying on filter centering',
.' Trying on filter centering',
],
];
}
@@ -224,7 +224,7 @@ final class AuthorizationHelperTest extends KernelTestCase
/**
* @dataProvider dataProvider_getReachableScopes
*
* @param bool $expectedResult
* @param bool $expectedResult
* @param string $message
*/
public function testGetReachableScopes(
@@ -240,7 +240,7 @@ final class AuthorizationHelperTest extends KernelTestCase
$this->assertEquals(
$expectedResult,
in_array($testedScope, $reachableScopes, true),
\in_array($testedScope, $reachableScopes, true),
$message
);
}
@@ -258,8 +258,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->getCenter()->willReturn($center);
$entity->getScope()->willReturn($scope);
@@ -313,8 +313,8 @@ final class AuthorizationHelperTest extends KernelTestCase
{
$centerA = $this->prepareCenter(1, 'center');
$centerB = $this->prepareCenter(2, 'centerB');
$scopeA = $this->prepareScope(3, 'other'); //the user will be granted this scope
$scopeB = $this->prepareScope(4, 'other'); //the user will be granted this scope
$scopeA = $this->prepareScope(3, 'other'); // the user will be granted this scope
$scopeB = $this->prepareScope(4, 'other'); // the user will be granted this scope
$user = $this->prepareUser([
[
'center' => $centerA, 'permissionsGroup' => [
@@ -354,7 +354,7 @@ final class AuthorizationHelperTest extends KernelTestCase
{
$center = $this->prepareCenter(1, 'center');
$centerB = $this->prepareCenter(1, 'centerB');
$scopeB = $this->prepareScope(2, 'other'); //the user will be granted this scope
$scopeB = $this->prepareScope(2, 'other'); // the user will be granted this scope
$user = $this->prepareUser([
[
'center' => $center, 'permissionsGroup' => [
@@ -383,7 +383,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertTrue($helper->userHasAccess(
@@ -407,7 +407,7 @@ final class AuthorizationHelperTest extends KernelTestCase
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertTrue($helper->userHasAccess(
@@ -419,8 +419,8 @@ final class AuthorizationHelperTest extends KernelTestCase
public function testUserHasAccessUserHasNoCenterEntityWithScope()
{
$centerA = $this->prepareCenter(1, 'center'); //the user will have this center
$centerB = $this->prepareCenter(2, 'centerB'); //the entity will have another center
$centerA = $this->prepareCenter(1, 'center'); // the user will have this center
$centerB = $this->prepareCenter(2, 'centerB'); // the entity will have another center
$scope = $this->prepareScope(1, 'default');
$user = $this->prepareUser([
[
@@ -431,8 +431,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->getCenter()->willReturn($centerB);
$entity->getScope()->willReturn($scope);
@@ -452,7 +452,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE'));
@@ -471,8 +471,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->getCenter()->willReturn($center);
$entity->getScope()->willReturn($scope);
@@ -503,7 +503,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->prophesize();
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($centerA);
$this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE'));
@@ -512,8 +512,8 @@ final class AuthorizationHelperTest extends KernelTestCase
public function testUserHasAccessUserHasNoScopeEntityWithScope()
{
$center = $this->prepareCenter(1, 'center');
$scopeA = $this->prepareScope(1, 'default'); //the entity will have this scope
$scopeB = $this->prepareScope(2, 'other'); //the user will be granted this scope
$scopeA = $this->prepareScope(1, 'default'); // the entity will have this scope
$scopeB = $this->prepareScope(2, 'other'); // the user will be granted this scope
$user = $this->prepareUser([
[
'center' => $center, 'permissionsGroup' => [
@@ -535,9 +535,9 @@ final class AuthorizationHelperTest extends KernelTestCase
{
$centerA = $this->prepareCenter(1, 'center');
$centerB = $this->prepareCenter(2, 'centerB');
$scopeA = $this->prepareScope(3, 'other'); //the user will be granted this scope
$scopeB = $this->prepareScope(4, 'other'); //the user will be granted this scope
$scopeC = $this->prepareScope(5, 'other'); //the user will be granted this scope
$scopeA = $this->prepareScope(3, 'other'); // the user will be granted this scope
$scopeB = $this->prepareScope(4, 'other'); // the user will be granted this scope
$scopeC = $this->prepareScope(5, 'other'); // the user will be granted this scope
$user = $this->prepareUser([
[
'center' => $centerA, 'permissionsGroup' => [
@@ -560,7 +560,7 @@ final class AuthorizationHelperTest extends KernelTestCase
$center = $this->prepareCenter(1, 'center');
$centerB = $this->prepareCenter(2, 'centerB');
$centerC = $this->prepareCenter(3, 'centerC');
$scopeB = $this->prepareScope(4, 'other'); //the user will be granted this scope
$scopeB = $this->prepareScope(4, 'other'); // the user will be granted this scope
$user = $this->prepareUser([
[
'center' => $center, 'permissionsGroup' => [