mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
update php-cs-fixer and rector + fix rules
This commit is contained in:
@@ -31,9 +31,8 @@ abstract class AbstractCRUDController extends AbstractController
|
||||
* This configuration si defined by `chill_main['crud']` or `chill_main['apis']`
|
||||
*/
|
||||
protected array $crudConfig = [];
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
|
||||
{
|
||||
}
|
||||
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
|
||||
/**
|
||||
* get the role given from the config.
|
||||
|
@@ -23,9 +23,8 @@ use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||
|
||||
class ApiController extends AbstractCRUDController
|
||||
{
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
|
||||
{
|
||||
}
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
|
||||
/**
|
||||
* Base method for handling api action.
|
||||
*
|
||||
|
@@ -60,7 +60,6 @@ class CRUDRoutesLoader extends Loader
|
||||
|
||||
/**
|
||||
* @param null $type
|
||||
*
|
||||
*/
|
||||
public function supports($resource, $type = null): bool
|
||||
{
|
||||
|
@@ -83,7 +83,7 @@ class LoadAndUpdateLanguagesCommand extends Command
|
||||
$languages = [];
|
||||
|
||||
foreach ($chillAvailableLanguages as $avLang) {
|
||||
$languages[$avLang] = \Symfony\Component\Intl\Languages::getNames();
|
||||
$languages[$avLang] = Languages::getNames();
|
||||
}
|
||||
|
||||
foreach (Languages::getNames() as $code => $lang) {
|
||||
@@ -105,7 +105,7 @@ class LoadAndUpdateLanguagesCommand extends Command
|
||||
$languageDB = $em->getRepository(Language::class)->find($code);
|
||||
|
||||
if (null === $languageDB) {
|
||||
$languageDB = new \Chill\MainBundle\Entity\Language();
|
||||
$languageDB = new Language();
|
||||
$languageDB->setId($code);
|
||||
$em->persist($languageDB);
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ class LoadCountriesCommand extends Command
|
||||
$names[$language] = Countries::getName($code, $language);
|
||||
}
|
||||
|
||||
$country = new \Chill\MainBundle\Entity\Country();
|
||||
$country = new Country();
|
||||
$country->setName($names)->setCountryCode($code);
|
||||
$countryEntities[] = $country;
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ class SetPasswordCommand extends Command
|
||||
public function _getUser($username)
|
||||
{
|
||||
return $this->entityManager
|
||||
->getRepository(\Chill\MainBundle\Entity\User::class)
|
||||
->getRepository(User::class)
|
||||
->findOneBy(['username' => $username]);
|
||||
}
|
||||
|
||||
|
@@ -20,9 +20,8 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
|
||||
class AddressApiController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
|
||||
{
|
||||
}
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
|
||||
|
||||
/**
|
||||
* Duplicate an existing address.
|
||||
*
|
||||
|
@@ -70,7 +70,7 @@ class ExportController extends AbstractController
|
||||
*/
|
||||
public function downloadResultAction(Request $request, mixed $alias)
|
||||
{
|
||||
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
|
||||
/** @var ExportManager $exportManager */
|
||||
$exportManager = $this->exportManager;
|
||||
$export = $exportManager->getExport($alias);
|
||||
$key = $request->query->get('key', null);
|
||||
@@ -108,13 +108,13 @@ class ExportController extends AbstractController
|
||||
*
|
||||
* @param string $alias
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/generate/{alias}", name="chill_main_export_generate", methods={"GET"})
|
||||
*/
|
||||
public function generateAction(Request $request, $alias)
|
||||
{
|
||||
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
|
||||
/** @var ExportManager $exportManager */
|
||||
$exportManager = $this->exportManager;
|
||||
$key = $request->query->get('key', null);
|
||||
$savedExport = $this->getSavedExportFromRequest($request);
|
||||
@@ -274,7 +274,7 @@ class ExportController extends AbstractController
|
||||
*/
|
||||
protected function createCreateFormExport(string $alias, string $step, array $data, ?SavedExport $savedExport): FormInterface
|
||||
{
|
||||
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
|
||||
/** @var ExportManager $exportManager */
|
||||
$exportManager = $this->exportManager;
|
||||
$isGenerate = str_starts_with($step, 'generate_');
|
||||
|
||||
@@ -444,7 +444,7 @@ class ExportController extends AbstractController
|
||||
*
|
||||
* @param string $alias
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
private function forwardToGenerate(Request $request, DirectExportInterface|ExportInterface $export, $alias, ?SavedExport $savedExport)
|
||||
{
|
||||
@@ -452,7 +452,7 @@ class ExportController extends AbstractController
|
||||
$dataFormatter = $this->session->get('formatter_step_raw', null);
|
||||
$dataExport = $this->session->get('export_step_raw', null);
|
||||
|
||||
if (null === $dataFormatter && $export instanceof \Chill\MainBundle\Export\ExportInterface) {
|
||||
if (null === $dataFormatter && $export instanceof ExportInterface) {
|
||||
return $this->redirectToRoute('chill_main_export_new', [
|
||||
'alias' => $alias,
|
||||
'step' => $this->getNextStep('generate', $export, true),
|
||||
@@ -531,7 +531,7 @@ class ExportController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
|
||||
/** @var ExportManager $exportManager */
|
||||
$exportManager = $this->exportManager;
|
||||
|
||||
$form = $this->createCreateFormExport($alias, 'centers', [], $savedExport);
|
||||
@@ -620,11 +620,11 @@ class ExportController extends AbstractController
|
||||
return 'export';
|
||||
|
||||
case 'export':
|
||||
if ($export instanceof \Chill\MainBundle\Export\ExportInterface) {
|
||||
if ($export instanceof ExportInterface) {
|
||||
return $reverse ? 'centers' : 'formatter';
|
||||
}
|
||||
|
||||
if ($export instanceof \Chill\MainBundle\Export\DirectExportInterface) {
|
||||
if ($export instanceof DirectExportInterface) {
|
||||
return $reverse ? 'centers' : 'generate';
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,8 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
class ScopeController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -85,7 +86,7 @@ class ScopeController extends AbstractController
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
$entities = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)->findAll();
|
||||
$entities = $em->getRepository(Scope::class)->findAll();
|
||||
|
||||
return $this->render('@ChillMain/Scope/index.html.twig', [
|
||||
'entities' => $entities,
|
||||
@@ -115,7 +116,7 @@ class ScopeController extends AbstractController
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
$scope = $em->getRepository(\Chill\MainBundle\Entity\Scope::class)->find($id);
|
||||
$scope = $em->getRepository(Scope::class)->find($id);
|
||||
|
||||
if (!$scope) {
|
||||
throw $this->createNotFoundException('Unable to find Scope entity.');
|
||||
|
@@ -45,7 +45,7 @@ class SearchController extends AbstractController
|
||||
/** @var Chill\MainBundle\Search\HasAdvancedSearchFormInterface $variable */
|
||||
$search = $this->searchProvider
|
||||
->getHasAdvancedFormByName($name);
|
||||
} catch (\Chill\MainBundle\Search\UnknowSearchNameException) {
|
||||
} catch (UnknowSearchNameException) {
|
||||
throw $this->createNotFoundException('no advanced search for '."{$name}");
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,7 @@ class UserController extends CRUDController
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
$user = $em->getRepository(\Chill\MainBundle\Entity\User::class)->find($uid);
|
||||
$user = $em->getRepository(User::class)->find($uid);
|
||||
|
||||
if (!$user) {
|
||||
throw $this->createNotFoundException('Unable to find User entity.');
|
||||
@@ -110,13 +110,13 @@ class UserController extends CRUDController
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
$user = $em->getRepository(\Chill\MainBundle\Entity\User::class)->find($uid);
|
||||
$user = $em->getRepository(User::class)->find($uid);
|
||||
|
||||
if (!$user) {
|
||||
throw $this->createNotFoundException('Unable to find User entity.');
|
||||
}
|
||||
|
||||
$groupCenter = $em->getRepository(\Chill\MainBundle\Entity\GroupCenter::class)
|
||||
$groupCenter = $em->getRepository(GroupCenter::class)
|
||||
->find($gcid);
|
||||
|
||||
if (!$groupCenter) {
|
||||
@@ -434,7 +434,7 @@ class UserController extends CRUDController
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
$groupCenterManaged = $em->getRepository(\Chill\MainBundle\Entity\GroupCenter::class)
|
||||
$groupCenterManaged = $em->getRepository(GroupCenter::class)
|
||||
->findOneBy([
|
||||
'center' => $groupCenter->getCenter(),
|
||||
'permissionsGroup' => $groupCenter->getPermissionsGroup(),
|
||||
|
@@ -570,7 +570,7 @@ class ChillMainExtension extends Extension implements
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => \Chill\MainBundle\Entity\UserJob::class,
|
||||
'class' => UserJob::class,
|
||||
'name' => 'user_job',
|
||||
'base_path' => '/api/1.0/main/user-job',
|
||||
'base_role' => 'ROLE_USER',
|
||||
@@ -634,7 +634,7 @@ class ChillMainExtension extends Extension implements
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => \Chill\MainBundle\Entity\Country::class,
|
||||
'class' => Country::class,
|
||||
'name' => 'country',
|
||||
'base_path' => '/api/1.0/main/country',
|
||||
'base_role' => 'ROLE_USER',
|
||||
@@ -654,7 +654,7 @@ class ChillMainExtension extends Extension implements
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => \Chill\MainBundle\Entity\User::class,
|
||||
'class' => User::class,
|
||||
'controller' => \Chill\MainBundle\Controller\UserApiController::class,
|
||||
'name' => 'user',
|
||||
'base_path' => '/api/1.0/main/user',
|
||||
@@ -696,7 +696,7 @@ class ChillMainExtension extends Extension implements
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => \Chill\MainBundle\Entity\Location::class,
|
||||
'class' => Location::class,
|
||||
'controller' => \Chill\MainBundle\Controller\LocationApiController::class,
|
||||
'name' => 'location',
|
||||
'base_path' => '/api/1.0/main/location',
|
||||
@@ -718,7 +718,7 @@ class ChillMainExtension extends Extension implements
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => \Chill\MainBundle\Entity\LocationType::class,
|
||||
'class' => LocationType::class,
|
||||
'controller' => \Chill\MainBundle\Controller\LocationTypeApiController::class,
|
||||
'name' => 'location_type',
|
||||
'base_path' => '/api/1.0/main/location-type',
|
||||
@@ -739,7 +739,7 @@ class ChillMainExtension extends Extension implements
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => \Chill\MainBundle\Entity\Civility::class,
|
||||
'class' => Civility::class,
|
||||
'name' => 'civility',
|
||||
'base_path' => '/api/1.0/main/civility',
|
||||
'base_role' => 'ROLE_USER',
|
||||
|
@@ -73,8 +73,8 @@ class PermissionsGroup
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->roleScopes = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->groupCenters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->roleScopes = new ArrayCollection();
|
||||
$this->groupCenters = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function addRoleScope(RoleScope $roleScope)
|
||||
|
@@ -189,7 +189,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Chill\MainBundle\Entity\User
|
||||
* @return User
|
||||
*/
|
||||
public function addGroupCenter(GroupCenter $groupCenter)
|
||||
{
|
||||
|
@@ -100,7 +100,7 @@ class CSVListFormatter implements FormatterInterface
|
||||
* @param array $filtersData an array containing the filters data. The key are the filters id, and the value are the data
|
||||
* @param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response The response to be shown
|
||||
* @return Response The response to be shown
|
||||
*/
|
||||
public function getResponse(
|
||||
$result,
|
||||
|
@@ -99,7 +99,7 @@ class CSVPivotedListFormatter implements FormatterInterface
|
||||
* @param array $filtersData an array containing the filters data. The key are the filters id, and the value are the data
|
||||
* @param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response The response to be shown
|
||||
* @return Response The response to be shown
|
||||
*/
|
||||
public function getResponse(
|
||||
$result,
|
||||
|
@@ -112,7 +112,7 @@ class SpreadsheetListFormatter implements FormatterInterface
|
||||
* @param array $filtersData an array containing the filters data. The key are the filters id, and the value are the data
|
||||
* @param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response The response to be shown
|
||||
* @return Response The response to be shown
|
||||
*/
|
||||
public function getResponse(
|
||||
$result,
|
||||
|
@@ -83,7 +83,7 @@ trait AppendScopeChoiceTypeTrait
|
||||
{
|
||||
$resolver
|
||||
->setRequired(['center', 'role'])
|
||||
->setAllowedTypes('center', \Chill\MainBundle\Entity\Center::class)
|
||||
->setAllowedTypes('center', Center::class)
|
||||
->setAllowedTypes('role', 'string');
|
||||
}
|
||||
|
||||
|
@@ -23,10 +23,10 @@ class ComposedGroupCenterType extends AbstractType
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('permissionsgroup', EntityType::class, [
|
||||
'class' => \Chill\MainBundle\Entity\PermissionsGroup::class,
|
||||
'class' => PermissionsGroup::class,
|
||||
'choice_label' => static fn (PermissionsGroup $group) => $group->getName(),
|
||||
])->add('center', EntityType::class, [
|
||||
'class' => \Chill\MainBundle\Entity\Center::class,
|
||||
'class' => Center::class,
|
||||
'choice_label' => static fn (Center $center) => $center->getName(),
|
||||
]);
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ class Select2CountryType extends AbstractType
|
||||
asort($choices, \SORT_STRING | \SORT_FLAG_CASE);
|
||||
|
||||
$resolver->setDefaults([
|
||||
'class' => \Chill\MainBundle\Entity\Country::class,
|
||||
'class' => Country::class,
|
||||
'choices' => array_combine(array_values($choices), array_keys($choices)),
|
||||
'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices)),
|
||||
]);
|
||||
|
@@ -52,7 +52,7 @@ class Select2LanguageType extends AbstractType
|
||||
asort($choices, \SORT_STRING | \SORT_FLAG_CASE);
|
||||
|
||||
$resolver->setDefaults([
|
||||
'class' => \Chill\MainBundle\Entity\Language::class,
|
||||
'class' => Language::class,
|
||||
'choices' => array_combine(array_values($choices), array_keys($choices)),
|
||||
'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices)),
|
||||
]);
|
||||
|
@@ -38,7 +38,7 @@ class WorkflowStepType extends AbstractType
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
/** @var \Chill\MainBundle\Entity\Workflow\EntityWorkflow $entityWorkflow */
|
||||
/** @var EntityWorkflow $entityWorkflow */
|
||||
$entityWorkflow = $options['entity_workflow'];
|
||||
$handler = $this->entityWorkflowManager->getHandler($entityWorkflow);
|
||||
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
||||
|
@@ -137,7 +137,7 @@ class Paginator implements PaginatorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Chill\MainBundle\Pagination\Page
|
||||
* @return Page
|
||||
*
|
||||
* @throws \RuntimeException if the next page does not exists
|
||||
*/
|
||||
|
@@ -43,7 +43,7 @@ class GeographicalUnitByAddressApiControllerTest extends WebTestCase
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$nb = $em->createQuery('SELECT COUNT(a) FROM '.Address::class.' a')->getSingleScalarResult();
|
||||
/** @var \Chill\MainBundle\Entity\Address $random */
|
||||
/** @var Address $random */
|
||||
$random = $em->createQuery('SELECT a FROM '.Address::class.' a')
|
||||
->setFirstResult(random_int(0, $nb))
|
||||
->setMaxResults(1)
|
||||
|
@@ -58,7 +58,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->prophet = new \Prophecy\Prophet();
|
||||
$this->prophet = new Prophet();
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
@@ -370,7 +370,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$user = $this->prepareUser([]);
|
||||
|
||||
$authorizationChecker = $this->prophet->prophesize();
|
||||
$authorizationChecker->willImplement(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class);
|
||||
$authorizationChecker->willImplement(AuthorizationCheckerInterface::class);
|
||||
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $center)
|
||||
->willReturn(true);
|
||||
|
||||
@@ -399,7 +399,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$user = $this->prepareUser([]);
|
||||
|
||||
$authorizationChecker = $this->prophet->prophesize();
|
||||
$authorizationChecker->willImplement(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class);
|
||||
$authorizationChecker->willImplement(AuthorizationCheckerInterface::class);
|
||||
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $center)
|
||||
->willReturn(true);
|
||||
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $centerB)
|
||||
@@ -435,7 +435,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
);
|
||||
|
||||
$export = $this->prophet->prophesize();
|
||||
$export->willImplement(\Chill\MainBundle\Export\ExportInterface::class);
|
||||
$export->willImplement(ExportInterface::class);
|
||||
$export->requiredRole()->willReturn('CHILL_STAT_DUMMY');
|
||||
|
||||
$result = $exportManager->isGrantedForElement($export->reveal(), null, []);
|
||||
|
@@ -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('\\'.HasCenterInterface::class);
|
||||
$entity->willImplement('\\'.HasScopeInterface::class);
|
||||
$entity->getCenter()->willReturn($center);
|
||||
$entity->getScope()->willReturn($scope);
|
||||
|
||||
@@ -383,7 +383,7 @@ final class AuthorizationHelperTest extends KernelTestCase
|
||||
]);
|
||||
$helper = $this->getAuthorizationHelper();
|
||||
$entity = $this->prophesize();
|
||||
$entity->willImplement('\\'.\Chill\MainBundle\Entity\HasCenterInterface::class);
|
||||
$entity->willImplement('\\'.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('\\'.HasCenterInterface::class);
|
||||
$entity->getCenter()->willReturn($center);
|
||||
|
||||
$this->assertTrue($helper->userHasAccess(
|
||||
@@ -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('\\'.HasCenterInterface::class);
|
||||
$entity->willImplement('\\'.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('\\'.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('\\'.HasCenterInterface::class);
|
||||
$entity->willImplement('\\'.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('\\'.HasCenterInterface::class);
|
||||
$entity->getCenter()->willReturn($centerA);
|
||||
|
||||
$this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE'));
|
||||
@@ -577,7 +577,7 @@ final class AuthorizationHelperTest extends KernelTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Chill\MainBundle\Security\Authorization\AuthorizationHelper
|
||||
* @return AuthorizationHelper
|
||||
*/
|
||||
private function getAuthorizationHelper()
|
||||
{
|
||||
|
Reference in New Issue
Block a user