cs: Switch to a stricter way of coding - this might break in a lot of places.

This commit is contained in:
Pol Dellaiera
2021-11-30 13:33:18 +01:00
parent 28d2c42454
commit 47c5855a21
957 changed files with 9025 additions and 568 deletions

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Tests\Security\Authorization;
use Chill\MainBundle\Entity\Center;
@@ -29,7 +38,7 @@ use function in_array;
* @internal
* @coversNothing
*/
class AuthorizationHelperTest extends KernelTestCase
final class AuthorizationHelperTest extends KernelTestCase
{
use PrepareCenterTrait;
use PrepareScopeTrait;
@@ -38,7 +47,7 @@ class AuthorizationHelperTest extends KernelTestCase
public function setUp()
{
static::bootKernel();
self::bootKernel();
}
public function dataProvider_getReachableCenters()
@@ -77,7 +86,7 @@ class AuthorizationHelperTest extends KernelTestCase
$userA,
new Role('CHILL_ROLE_1'),
null
)),
), true),
'center A should be available for userA, with role 1 ',
],
[
@@ -86,7 +95,7 @@ class AuthorizationHelperTest extends KernelTestCase
$userA,
new Role('CHILL_ROLE_2'),
null
)),
), true),
'center A should be available for userA, with role 2 ',
],
[
@@ -95,7 +104,7 @@ class AuthorizationHelperTest extends KernelTestCase
$userA,
new Role('CHILL_ROLE_2'),
null
)),
), true),
'center A should be available for userA, with role 2 ',
],
[
@@ -104,7 +113,7 @@ class AuthorizationHelperTest extends KernelTestCase
$userA,
new Role('CHILL_ROLE_1'),
null
)),
), true),
'center B should NOT be available for userA, with role 1 ',
],
// with scope
@@ -114,7 +123,7 @@ class AuthorizationHelperTest extends KernelTestCase
$userA,
new Role('CHILL_ROLE_1'),
$scopeB
)),
), true),
'center A should be available for userA, with role 1, scopeC ',
],
[
@@ -123,7 +132,7 @@ class AuthorizationHelperTest extends KernelTestCase
$userA,
new Role('CHILL_ROLE_2'),
$scopeC
)),
), true),
'center A should NOT be available for userA, with role 2, scopeA ',
],
[
@@ -132,7 +141,7 @@ class AuthorizationHelperTest extends KernelTestCase
$userA,
new Role('CHILL_ROLE_2'),
$scopeA
)),
), true),
'center B should be available for userA, with role 2, scopeA ',
],
];
@@ -195,7 +204,7 @@ class AuthorizationHelperTest extends KernelTestCase
public function testFindUsersReaching()
{
$centerA = static::$kernel->getContainer()
$centerA = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository(Center::class)
->findOneByName('Center A');
@@ -254,7 +263,7 @@ class AuthorizationHelperTest extends KernelTestCase
$this->assertEquals(
$expectedResult,
in_array($testedScope, $reachableScopes),
in_array($testedScope, $reachableScopes, true),
$message
);
}
@@ -577,7 +586,7 @@ class AuthorizationHelperTest extends KernelTestCase
*/
private function getAuthorizationHelper()
{
return static::$container
return self::$container
->get('chill.main.security.authorization.helper');
}
}