mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
cs: Second part - ignore test/app
subdirectory.
This commit is contained in:
parent
5f37304796
commit
3ea35682eb
@ -15,6 +15,7 @@ $config = require __DIR__ . '/tests/app/vendor/drupol/php-conventions/config/php
|
||||
$config
|
||||
->getFinder()
|
||||
->ignoreDotFiles(false)
|
||||
->notPath('tests/app')
|
||||
->name(['.php_cs.dist.php']);
|
||||
|
||||
$rules = $config->getRules();
|
||||
|
@ -29,8 +29,7 @@ namespace Chill\MainBundle\DependencyInjection;
|
||||
public function __construct(
|
||||
array $widgetFactories = [],
|
||||
ContainerBuilder $containerBuilder
|
||||
)
|
||||
{
|
||||
) {
|
||||
// we register here widget factories (see below)
|
||||
$this->setWidgetFactories($widgetFactories);
|
||||
// we will need the container builder later...
|
||||
|
@ -50,7 +50,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
|
||||
foreach ($persons as $person) {
|
||||
$activityNbr = rand(0, 3);
|
||||
|
||||
for ($i = 0; $i < $activityNbr; ++$i ) {
|
||||
for ($i = 0; $i < $activityNbr; ++$i) {
|
||||
$activity = $this->newRandomActivity($person);
|
||||
|
||||
if (null !== $activity) {
|
||||
|
@ -56,8 +56,8 @@ class Configuration implements ConfigurationInterface
|
||||
->cannotBeEmpty()
|
||||
->validate()
|
||||
->ifTrue(function ($data) {
|
||||
return !is_int($data);
|
||||
})->thenInvalid('The value %s is not a valid integer')
|
||||
return !is_int($data);
|
||||
})->thenInvalid('The value %s is not a valid integer')
|
||||
->end()
|
||||
->end()
|
||||
->scalarNode('label')
|
||||
|
@ -125,24 +125,24 @@ class ActivityType extends AbstractType
|
||||
$builder->get('socialIssues')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $socialIssuesAsIterable): string {
|
||||
$socialIssueIds = [];
|
||||
$socialIssueIds = [];
|
||||
|
||||
foreach ($socialIssuesAsIterable as $value) {
|
||||
$socialIssueIds[] = $value->getId();
|
||||
}
|
||||
foreach ($socialIssuesAsIterable as $value) {
|
||||
$socialIssueIds[] = $value->getId();
|
||||
}
|
||||
|
||||
return implode(',', $socialIssueIds);
|
||||
},
|
||||
return implode(',', $socialIssueIds);
|
||||
},
|
||||
function (?string $socialIssuesAsString): array {
|
||||
if (null === $socialIssuesAsString) {
|
||||
return [];
|
||||
}
|
||||
if (null === $socialIssuesAsString) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_map(
|
||||
fn (string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $socialIssuesAsString)
|
||||
);
|
||||
}
|
||||
return array_map(
|
||||
fn (string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $socialIssuesAsString)
|
||||
);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
@ -151,24 +151,24 @@ class ActivityType extends AbstractType
|
||||
$builder->get('socialActions')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $socialActionsAsIterable): string {
|
||||
$socialActionIds = [];
|
||||
$socialActionIds = [];
|
||||
|
||||
foreach ($socialActionsAsIterable as $value) {
|
||||
$socialActionIds[] = $value->getId();
|
||||
}
|
||||
foreach ($socialActionsAsIterable as $value) {
|
||||
$socialActionIds[] = $value->getId();
|
||||
}
|
||||
|
||||
return implode(',', $socialActionIds);
|
||||
},
|
||||
return implode(',', $socialActionIds);
|
||||
},
|
||||
function (?string $socialActionsAsString): array {
|
||||
if (null === $socialActionsAsString) {
|
||||
return [];
|
||||
}
|
||||
if (null === $socialActionsAsString) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_map(
|
||||
fn (string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $socialActionsAsString)
|
||||
);
|
||||
}
|
||||
return array_map(
|
||||
fn (string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $socialActionsAsString)
|
||||
);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
@ -248,20 +248,20 @@ class ActivityType extends AbstractType
|
||||
$builder->get('persons')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $personsAsIterable): string {
|
||||
$personIds = [];
|
||||
$personIds = [];
|
||||
|
||||
foreach ($personsAsIterable as $value) {
|
||||
$personIds[] = $value->getId();
|
||||
}
|
||||
foreach ($personsAsIterable as $value) {
|
||||
$personIds[] = $value->getId();
|
||||
}
|
||||
|
||||
return implode(',', $personIds);
|
||||
},
|
||||
return implode(',', $personIds);
|
||||
},
|
||||
function (?string $personsAsString): array {
|
||||
return array_map(
|
||||
fn (string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $personsAsString)
|
||||
);
|
||||
}
|
||||
return array_map(
|
||||
fn (string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $personsAsString)
|
||||
);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
@ -270,20 +270,20 @@ class ActivityType extends AbstractType
|
||||
$builder->get('thirdParties')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $thirdpartyAsIterable): string {
|
||||
$thirdpartyIds = [];
|
||||
$thirdpartyIds = [];
|
||||
|
||||
foreach ($thirdpartyAsIterable as $value) {
|
||||
$thirdpartyIds[] = $value->getId();
|
||||
}
|
||||
foreach ($thirdpartyAsIterable as $value) {
|
||||
$thirdpartyIds[] = $value->getId();
|
||||
}
|
||||
|
||||
return implode(',', $thirdpartyIds);
|
||||
},
|
||||
return implode(',', $thirdpartyIds);
|
||||
},
|
||||
function (?string $thirdpartyAsString): array {
|
||||
return array_map(
|
||||
fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $thirdpartyAsString)
|
||||
);
|
||||
}
|
||||
return array_map(
|
||||
fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $thirdpartyAsString)
|
||||
);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
@ -303,20 +303,20 @@ class ActivityType extends AbstractType
|
||||
$builder->get('users')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $usersAsIterable): string {
|
||||
$userIds = [];
|
||||
$userIds = [];
|
||||
|
||||
foreach ($usersAsIterable as $value) {
|
||||
$userIds[] = $value->getId();
|
||||
}
|
||||
foreach ($usersAsIterable as $value) {
|
||||
$userIds[] = $value->getId();
|
||||
}
|
||||
|
||||
return implode(',', $userIds);
|
||||
},
|
||||
return implode(',', $userIds);
|
||||
},
|
||||
function (?string $usersAsString): array {
|
||||
return array_map(
|
||||
fn (string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $usersAsString)
|
||||
);
|
||||
}
|
||||
return array_map(
|
||||
fn (string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $usersAsString)
|
||||
);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
|
||||
public function __construct(
|
||||
AuthorizationCheckerInterface $authorizationChecker,
|
||||
TranslatorInterface $translator
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
}
|
||||
|
@ -71,8 +71,7 @@ class TranslatableActivityReasonTest extends TypeTestCase
|
||||
protected function getTranslatableStringHelper(
|
||||
$locale = 'en',
|
||||
$fallbackLocale = 'en'
|
||||
)
|
||||
{
|
||||
) {
|
||||
$prophet = new \Prophecy\Prophet();
|
||||
$requestStack = $prophet->prophesize();
|
||||
$request = $prophet->prophesize();
|
||||
|
@ -26,11 +26,11 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||
*/
|
||||
class ActivityVoterTest extends KernelTestCase
|
||||
{
|
||||
use PrepareUserTrait;
|
||||
use PrepareCenterTrait;
|
||||
use PrepareScopeTrait;
|
||||
use PreparePersonTrait;
|
||||
use PrepareActivityTrait;
|
||||
use PrepareCenterTrait;
|
||||
use PreparePersonTrait;
|
||||
use PrepareScopeTrait;
|
||||
use PrepareUserTrait;
|
||||
|
||||
/**
|
||||
* @var \Prophecy\Prophet
|
||||
@ -132,8 +132,7 @@ class ActivityVoterTest extends KernelTestCase
|
||||
Center $center,
|
||||
$attribute,
|
||||
$message
|
||||
)
|
||||
{
|
||||
) {
|
||||
$token = $this->prepareToken($user);
|
||||
$activity = $this->prepareActivity($scope, $this->preparePerson($center));
|
||||
|
||||
|
@ -125,8 +125,8 @@ class Configuration implements ConfigurationInterface
|
||||
->cannotBeEmpty()
|
||||
->validate()
|
||||
->ifTrue(function ($data) {
|
||||
return !is_int($data);
|
||||
})->thenInvalid('The value %s is not a valid integer')
|
||||
return !is_int($data);
|
||||
})->thenInvalid('The value %s is not a valid integer')
|
||||
->end()
|
||||
->end()
|
||||
->scalarNode('label')
|
||||
|
@ -201,20 +201,20 @@ class CalendarType extends AbstractType
|
||||
$builder->get('invites')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $usersAsIterable): string {
|
||||
$userIds = [];
|
||||
$userIds = [];
|
||||
|
||||
foreach ($usersAsIterable as $value) {
|
||||
$userIds[] = $value->getId();
|
||||
}
|
||||
foreach ($usersAsIterable as $value) {
|
||||
$userIds[] = $value->getId();
|
||||
}
|
||||
|
||||
return implode(',', $userIds);
|
||||
},
|
||||
return implode(',', $userIds);
|
||||
},
|
||||
function (?string $usersAsString): array {
|
||||
return array_map(
|
||||
fn (string $id): ?Invite => $this->om->getRepository(Invite::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $usersAsString)
|
||||
);
|
||||
}
|
||||
return array_map(
|
||||
fn (string $id): ?Invite => $this->om->getRepository(Invite::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $usersAsString)
|
||||
);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -54,8 +54,7 @@ class CustomFieldChoice extends AbstractCustomField
|
||||
TranslatorInterface $translator,
|
||||
TwigEngine $templating,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->defaultLocales = $translator->getFallbackLocales();
|
||||
$this->templating = $templating;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
|
@ -41,8 +41,7 @@ class CustomFieldText extends AbstractCustomField
|
||||
RequestStack $requestStack,
|
||||
TwigEngine $templating,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->requestStack = $requestStack;
|
||||
$this->templating = $templating;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
|
@ -41,8 +41,7 @@ class CustomFieldTitle extends AbstractCustomField
|
||||
RequestStack $requestStack,
|
||||
TwigEngine $templating,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->requestStack = $requestStack;
|
||||
$this->templating = $templating;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
|
@ -25,8 +25,7 @@ class CustomFieldDataTransformer implements DataTransformerInterface
|
||||
public function __construct(
|
||||
CustomFieldInterface $customFieldDefinition,
|
||||
CustomField $customField
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->customFieldDefinition = $customFieldDefinition;
|
||||
$this->customField = $customField;
|
||||
}
|
||||
|
@ -39,8 +39,7 @@ class CustomFieldsHelper
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
CustomFieldProvider $provider
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->provider = $provider;
|
||||
}
|
||||
|
@ -137,8 +137,7 @@ class DocGeneratorTemplateController extends AbstractController
|
||||
public function listTemplateApiAction(
|
||||
string $entityClassName,
|
||||
DocGeneratorTemplateRepository $templateRepository
|
||||
): Response
|
||||
{
|
||||
): Response {
|
||||
$entities = $templateRepository->findByEntity($entityClassName);
|
||||
|
||||
$ret = [];
|
||||
|
@ -120,7 +120,7 @@ class EventController extends AbstractController
|
||||
$this->addFlash(
|
||||
'success',
|
||||
$this->get('translator')
|
||||
->trans('The event has been sucessfully removed')
|
||||
->trans('The event has been sucessfully removed')
|
||||
);
|
||||
|
||||
return $this->redirectToRoute('chill_main_search', [
|
||||
|
@ -275,7 +275,7 @@ class ParticipationController extends AbstractController
|
||||
$this->addFlash(
|
||||
'success',
|
||||
$this->get('translator')
|
||||
->trans('The participation has been sucessfully removed')
|
||||
->trans('The participation has been sucessfully removed')
|
||||
);
|
||||
|
||||
return $this->redirectToRoute('chill_event__event_show', [
|
||||
@ -551,8 +551,7 @@ class ParticipationController extends AbstractController
|
||||
Request $request,
|
||||
Participation $participation,
|
||||
bool $multiple = false
|
||||
)
|
||||
{
|
||||
) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
if ($em->contains($participation)) {
|
||||
@ -653,8 +652,8 @@ class ParticipationController extends AbstractController
|
||||
$ignoredParticipations[] = $participation
|
||||
->getEvent()->getParticipations()->filter(
|
||||
function (Participation $p) use ($participation) {
|
||||
return $p->getPerson()->getId() === $participation->getPerson()->getId();
|
||||
}
|
||||
return $p->getPerson()->getId() === $participation->getPerson()->getId();
|
||||
}
|
||||
)->first();
|
||||
} else {
|
||||
$newParticipations[] = $participation;
|
||||
|
@ -45,8 +45,8 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
|
||||
->setCenter($center)
|
||||
->setCircle(
|
||||
$this->getReference(
|
||||
LoadScopes::$references[array_rand(LoadScopes::$references)]
|
||||
)
|
||||
LoadScopes::$references[array_rand(LoadScopes::$references)]
|
||||
)
|
||||
);
|
||||
$manager->persist($event);
|
||||
$events[] = $event;
|
||||
|
@ -70,20 +70,20 @@ class PickRoleType extends AbstractType
|
||||
$builder->addEventListener(
|
||||
FormEvents::PRE_SET_DATA,
|
||||
function (FormEvent $event) use ($options) {
|
||||
if (null === $options['event_type']) {
|
||||
$form = $event->getForm();
|
||||
$name = $form->getName();
|
||||
$config = $form->getConfig();
|
||||
$type = $config->getType()->getName();
|
||||
$options = $config->getOptions();
|
||||
if (null === $options['event_type']) {
|
||||
$form = $event->getForm();
|
||||
$name = $form->getName();
|
||||
$config = $form->getConfig();
|
||||
$type = $config->getType()->getName();
|
||||
$options = $config->getOptions();
|
||||
|
||||
$form->getParent()->add($name, $type, array_replace($options, [
|
||||
'group_by' => function (Role $r) {
|
||||
return $this->translatableStringHelper->localize($r->getType()->getName());
|
||||
},
|
||||
]));
|
||||
}
|
||||
}
|
||||
$form->getParent()->add($name, $type, array_replace($options, [
|
||||
'group_by' => function (Role $r) {
|
||||
return $this->translatableStringHelper->localize($r->getType()->getName());
|
||||
},
|
||||
]));
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -74,17 +74,17 @@ class PickStatusType extends AbstractType
|
||||
$builder->addEventListener(
|
||||
FormEvents::PRE_SET_DATA,
|
||||
function (FormEvent $event) {
|
||||
$form = $event->getForm();
|
||||
$name = $form->getName();
|
||||
$config = $form->getConfig();
|
||||
$type = $config->getType()->getName();
|
||||
$options = $config->getOptions();
|
||||
$form->getParent()->add($name, $type, array_replace($options, [
|
||||
'group_by' => function (Status $s) {
|
||||
return $this->translatableStringHelper->localize($s->getType()->getName());
|
||||
},
|
||||
]));
|
||||
}
|
||||
$form = $event->getForm();
|
||||
$name = $form->getName();
|
||||
$config = $form->getConfig();
|
||||
$type = $config->getType()->getName();
|
||||
$options = $config->getOptions();
|
||||
$form->getParent()->add($name, $type, array_replace($options, [
|
||||
'group_by' => function (Status $s) {
|
||||
return $this->translatableStringHelper->localize($s->getType()->getName());
|
||||
},
|
||||
]));
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -92,8 +92,7 @@ class EventSearch extends AbstractSearch
|
||||
$limit = 50,
|
||||
array $options = [],
|
||||
$format = 'html'
|
||||
)
|
||||
{
|
||||
) {
|
||||
$total = $this->count($terms);
|
||||
$paginator = $this->paginationFactory->create($total);
|
||||
|
||||
|
@ -235,9 +235,9 @@ class ParticipationControllerTest extends WebTestCase
|
||||
$this->personsIdsCache = array_merge(
|
||||
$this->personsIdsCache,
|
||||
$event->getParticipations()->map(
|
||||
function ($p) { return $p->getPerson()->getId(); }
|
||||
)
|
||||
->toArray()
|
||||
function ($p) { return $p->getPerson()->getId(); }
|
||||
)
|
||||
->toArray()
|
||||
);
|
||||
// get some random people
|
||||
$person1 = $this->getRandomPerson();
|
||||
@ -476,8 +476,7 @@ class ParticipationControllerTest extends WebTestCase
|
||||
protected function getRandomEventWithMultipleParticipations(
|
||||
$centerName = 'Center A',
|
||||
$circleName = 'social'
|
||||
)
|
||||
{
|
||||
) {
|
||||
$event = $this->getRandomEvent($centerName, $circleName);
|
||||
|
||||
return $event->getParticipations()->count() > 1 ?
|
||||
|
@ -714,8 +714,7 @@ class CRUDController extends AbstractController
|
||||
int $totalItems,
|
||||
PaginatorInterface $paginator,
|
||||
?FilterOrderHelper $filterOrder = null
|
||||
)
|
||||
{
|
||||
) {
|
||||
$query = $this->queryEntities($action, $request, $paginator, $filterOrder);
|
||||
|
||||
return $query->getQuery()->getResult();
|
||||
|
@ -206,6 +206,7 @@ class ExportController extends AbstractController
|
||||
*
|
||||
* @param string $alias
|
||||
* @param array $data the data from previous step. Required for steps 'formatter' and 'generate_formatter'
|
||||
* @param mixed $step
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form
|
||||
*/
|
||||
|
@ -35,8 +35,7 @@ class NotificationController extends AbstractController
|
||||
NotificationRepository $notificationRepository,
|
||||
NotificationRenderer $notificationRenderer,
|
||||
PaginatorFactory $paginatorFactory
|
||||
)
|
||||
{
|
||||
) {
|
||||
$currentUser = $this->security->getUser();
|
||||
|
||||
$notificationsNbr = $notificationRepository->countAllForAttendee(($currentUser));
|
||||
|
@ -358,19 +358,19 @@ class PermissionsGroupController extends AbstractController
|
||||
usort(
|
||||
$roleScopes,
|
||||
function (RoleScope $a, RoleScope $b) use ($translatableStringHelper) {
|
||||
if ($a->getScope() === null) {
|
||||
return 1;
|
||||
}
|
||||
if ($a->getScope() === null) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($b->getScope() === null) {
|
||||
return +1;
|
||||
}
|
||||
if ($b->getScope() === null) {
|
||||
return +1;
|
||||
}
|
||||
|
||||
return strcmp(
|
||||
$translatableStringHelper->localize($a->getScope()->getName()),
|
||||
$translatableStringHelper->localize($b->getScope()->getName())
|
||||
);
|
||||
}
|
||||
return strcmp(
|
||||
$translatableStringHelper->localize($a->getScope()->getName()),
|
||||
$translatableStringHelper->localize($b->getScope()->getName())
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// sort role scope by title
|
||||
@ -526,8 +526,7 @@ class PermissionsGroupController extends AbstractController
|
||||
private function createDeleteRoleScopeForm(
|
||||
PermissionsGroup $permissionsGroup,
|
||||
RoleScope $roleScope
|
||||
)
|
||||
{
|
||||
) {
|
||||
return $this->createFormBuilder()
|
||||
->setAction($this->generateUrl(
|
||||
'admin_permissionsgroup_delete_role_scope',
|
||||
@ -571,12 +570,12 @@ class PermissionsGroupController extends AbstractController
|
||||
$expandedRoles[$roleScope->getRole()] =
|
||||
array_map(
|
||||
function (Role $role) {
|
||||
return $role->getRole();
|
||||
},
|
||||
return $role->getRole();
|
||||
},
|
||||
$this->roleHierarchy
|
||||
->getReachableRoles(
|
||||
[new Role($roleScope->getRole())]
|
||||
)
|
||||
->getReachableRoles(
|
||||
[new Role($roleScope->getRole())]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -51,15 +51,15 @@ class PostalCodeController extends AbstractController
|
||||
$query = $this->getDoctrine()->getManager()
|
||||
->createQuery(
|
||||
sprintf(
|
||||
'SELECT p.id AS id, p.name AS name, p.code AS code, '
|
||||
'SELECT p.id AS id, p.name AS name, p.code AS code, '
|
||||
. 'country.name AS country_name, '
|
||||
. 'country.countryCode AS country_code '
|
||||
. 'FROM %s p '
|
||||
. 'JOIN p.country country '
|
||||
. 'WHERE LOWER(p.name) LIKE LOWER(:pattern) OR LOWER(p.code) LIKE LOWER(:pattern) '
|
||||
. 'ORDER BY code',
|
||||
PostalCode::class
|
||||
)
|
||||
PostalCode::class
|
||||
)
|
||||
)
|
||||
->setParameter('pattern', '%' . $pattern . '%')
|
||||
->setMaxResults(30);
|
||||
|
@ -78,8 +78,8 @@ class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, Cont
|
||||
->setUsername($username)
|
||||
->setPassword(
|
||||
$encoderFactory
|
||||
->getEncoder($user)
|
||||
->encodePassword('password', $user->getSalt())
|
||||
->getEncoder($user)
|
||||
->encodePassword('password', $user->getSalt())
|
||||
)
|
||||
->setEmail(sprintf('%s@chill.social', str_replace(' ', '', $username)));
|
||||
|
||||
|
@ -36,10 +36,10 @@ class ACLFlagsCompilerPass implements CompilerPassInterface
|
||||
default:
|
||||
throw new LogicException(
|
||||
sprintf(
|
||||
"This tag 'scope' is not implemented: %s, on service with id %s",
|
||||
$tag['scope'],
|
||||
$id
|
||||
)
|
||||
"This tag 'scope' is not implemented: %s, on service with id %s",
|
||||
$tag['scope'],
|
||||
$id
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -47,8 +47,7 @@ class ExportsCompilerPass implements CompilerPassInterface
|
||||
private function compileAggregators(
|
||||
Definition $chillManagerDefinition,
|
||||
ContainerBuilder $container
|
||||
)
|
||||
{
|
||||
) {
|
||||
$taggedServices = $container->findTaggedServiceIds(
|
||||
'chill.export_aggregator'
|
||||
);
|
||||
@ -79,8 +78,7 @@ class ExportsCompilerPass implements CompilerPassInterface
|
||||
private function compileExportElementsProvider(
|
||||
Definition $chillManagerDefinition,
|
||||
ContainerBuilder $container
|
||||
)
|
||||
{
|
||||
) {
|
||||
$taggedServices = $container->findTaggedServiceIds(
|
||||
'chill.export_elements_provider'
|
||||
);
|
||||
@ -111,8 +109,7 @@ class ExportsCompilerPass implements CompilerPassInterface
|
||||
private function compileExports(
|
||||
Definition $chillManagerDefinition,
|
||||
ContainerBuilder $container
|
||||
)
|
||||
{
|
||||
) {
|
||||
$taggedServices = $container->findTaggedServiceIds(
|
||||
'chill.export'
|
||||
);
|
||||
@ -143,8 +140,7 @@ class ExportsCompilerPass implements CompilerPassInterface
|
||||
private function compileFilters(
|
||||
Definition $chillManagerDefinition,
|
||||
ContainerBuilder $container
|
||||
)
|
||||
{
|
||||
) {
|
||||
$taggedServices = $container->findTaggedServiceIds(
|
||||
'chill.export_filter'
|
||||
);
|
||||
@ -175,8 +171,7 @@ class ExportsCompilerPass implements CompilerPassInterface
|
||||
private function compileFormatters(
|
||||
Definition $chillManagerDefinition,
|
||||
ContainerBuilder $container
|
||||
)
|
||||
{
|
||||
) {
|
||||
$taggedServices = $container->findTaggedServiceIds(
|
||||
'chill.export_formatter'
|
||||
);
|
||||
|
@ -27,8 +27,7 @@ class Configuration implements ConfigurationInterface
|
||||
public function __construct(
|
||||
array $widgetFactories,
|
||||
ContainerBuilder $containerBuilder
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->setWidgetFactories($widgetFactories);
|
||||
$this->containerBuilder = $containerBuilder;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ abstract class AbstractWidgetFactory implements WidgetFactoryInterface
|
||||
{
|
||||
return $containerBuilder->getDefinition(
|
||||
$this
|
||||
->getServiceId($containerBuilder, $place, $order, $config)
|
||||
->getServiceId($containerBuilder, $place, $order, $config)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -120,8 +120,8 @@ class PermissionsGroup
|
||||
{
|
||||
$roleScopesId = array_map(
|
||||
function (RoleScope $roleScope) {
|
||||
return $roleScope->getId();
|
||||
},
|
||||
return $roleScope->getId();
|
||||
},
|
||||
$this->getRoleScopes()->toArray()
|
||||
);
|
||||
$countedIds = array_count_values($roleScopesId);
|
||||
|
@ -92,8 +92,7 @@ class ExportManager
|
||||
AuthorizationCheckerInterface $authorizationChecker,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
TokenStorageInterface $tokenStorage
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->logger = $logger;
|
||||
$this->em = $em;
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
@ -280,9 +279,9 @@ class ExportManager
|
||||
if (!is_iterable($result)) {
|
||||
throw new UnexpectedValueException(
|
||||
sprintf(
|
||||
'The result of the export should be an iterable, %s given',
|
||||
gettype($result)
|
||||
)
|
||||
'The result of the export should be an iterable, %s given',
|
||||
gettype($result)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -602,8 +601,7 @@ class ExportManager
|
||||
QueryBuilder $qb,
|
||||
$data,
|
||||
array $center
|
||||
)
|
||||
{
|
||||
) {
|
||||
$aggregators = $this->retrieveUsedAggregators($data);
|
||||
|
||||
foreach ($aggregators as $alias => $aggregator) {
|
||||
@ -626,8 +624,7 @@ class ExportManager
|
||||
QueryBuilder $qb,
|
||||
$data,
|
||||
array $centers
|
||||
)
|
||||
{
|
||||
) {
|
||||
$filters = $this->retrieveUsedFilters($data);
|
||||
|
||||
foreach ($filters as $alias => $filter) {
|
||||
|
@ -55,8 +55,7 @@ class CSVFormatter implements FormatterInterface
|
||||
public function __construct(
|
||||
TranslatorInterface $translator,
|
||||
ExportManager $manager
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->exportManager = $manager;
|
||||
}
|
||||
|
@ -102,8 +102,7 @@ trait AppendScopeChoiceTypeTrait
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
ObjectManager $om,
|
||||
$name = 'scope'
|
||||
)
|
||||
{
|
||||
) {
|
||||
$reachableScopes = $authorizationHelper
|
||||
->getReachableScopes($user, $role, $center);
|
||||
|
||||
@ -119,21 +118,21 @@ trait AppendScopeChoiceTypeTrait
|
||||
$builder->addEventListener(
|
||||
FormEvents::PRE_SET_DATA,
|
||||
function (FormEvent $event) use ($choices, $name, $dataTransformer, $builder) {
|
||||
$form = $event->getForm();
|
||||
$form->add(
|
||||
$builder
|
||||
->create(
|
||||
$name,
|
||||
ChoiceType::class,
|
||||
[
|
||||
'choices' => array_combine(array_values($choices), array_keys($choices)),
|
||||
'auto_initialize' => false,
|
||||
]
|
||||
)
|
||||
->addModelTransformer($dataTransformer)
|
||||
->getForm()
|
||||
);
|
||||
}
|
||||
$form = $event->getForm();
|
||||
$form->add(
|
||||
$builder
|
||||
->create(
|
||||
$name,
|
||||
ChoiceType::class,
|
||||
[
|
||||
'choices' => array_combine(array_values($choices), array_keys($choices)),
|
||||
'auto_initialize' => false,
|
||||
]
|
||||
)
|
||||
->addModelTransformer($dataTransformer)
|
||||
->getForm()
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -58,8 +58,7 @@ class PickCenterType extends AbstractType
|
||||
TokenStorageInterface $tokenStorage,
|
||||
ExportManager $exportManager,
|
||||
AuthorizationHelper $authorizationHelper
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->exportManager = $exportManager;
|
||||
$this->user = $tokenStorage->getToken()->getUser();
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
|
@ -105,14 +105,14 @@ class UserType extends AbstractType
|
||||
} else {
|
||||
$builder->add(
|
||||
$builder
|
||||
->create('enabled', ChoiceType::class, [
|
||||
'choices' => [
|
||||
'Disabled, the user is not allowed to login' => 0,
|
||||
'Enabled, the user is active' => 1,
|
||||
],
|
||||
'expanded' => false,
|
||||
'multiple' => false,
|
||||
])
|
||||
->create('enabled', ChoiceType::class, [
|
||||
'choices' => [
|
||||
'Disabled, the user is not allowed to login' => 0,
|
||||
'Enabled, the user is active' => 1,
|
||||
],
|
||||
'expanded' => false,
|
||||
'multiple' => false,
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,7 @@ final class NotificationRenderer
|
||||
public function __construct(
|
||||
AccompanyingPeriodNotificationRenderer $accompanyingPeriodNotificationRenderer,
|
||||
ActivityNotificationRenderer $activityNotificationRenderer
|
||||
)
|
||||
{
|
||||
) {
|
||||
// TODO configure automatically
|
||||
// TODO CREER UNE INTERFACE POUR ETRE SUR QUE LES RENDERERS SONT OK
|
||||
|
||||
|
@ -138,8 +138,7 @@ class SearchProvider
|
||||
$limit = 50,
|
||||
array $options = [],
|
||||
$format = 'html'
|
||||
)
|
||||
{
|
||||
) {
|
||||
$terms = $this->parse($pattern);
|
||||
$search = $this->getByName($name);
|
||||
|
||||
@ -169,8 +168,7 @@ class SearchProvider
|
||||
$limit = 50,
|
||||
array $options = [],
|
||||
$format = 'html'
|
||||
)
|
||||
{
|
||||
) {
|
||||
$terms = $this->parse($pattern);
|
||||
$results = [];
|
||||
|
||||
|
@ -35,6 +35,7 @@ class AddressRender implements ChillEntityRenderInterface
|
||||
|
||||
/**
|
||||
* @param Address addr
|
||||
* @param mixed $addr
|
||||
*/
|
||||
public function renderBox($addr, array $options): string
|
||||
{
|
||||
|
@ -47,10 +47,10 @@ class FilterOrderHelper
|
||||
$this->checkboxes[$name] = [
|
||||
'choices' => $choices, 'default' => $default,
|
||||
'trans' => array_merge(
|
||||
$trans,
|
||||
0 < $missing ?
|
||||
$trans,
|
||||
0 < $missing ?
|
||||
array_fill(0, $missing, null) : []
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
return $this;
|
||||
|
@ -170,9 +170,9 @@ abstract class AbstractFilterTest extends KernelTestCase
|
||||
}
|
||||
$this->assertTrue(
|
||||
$catalogue->has(
|
||||
$description[0],
|
||||
$description[2] ?? 'messages'
|
||||
),
|
||||
$description[0],
|
||||
$description[2] ?? 'messages'
|
||||
),
|
||||
sprintf('Test that the message returned by getDescriptionAction is '
|
||||
. 'present in the catalogue of translations. HINT : check that "%s" '
|
||||
. 'is correctly translated', $description[0])
|
||||
|
@ -230,11 +230,11 @@ class ExportManagerTest extends KernelTestCase
|
||||
Argument::is(['a' => 'b'])
|
||||
)
|
||||
->will(function () use ($em) {
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb = $em->createQueryBuilder();
|
||||
|
||||
return $qb->addSelect('COUNT(user.id) as export')
|
||||
->from('ChillMainBundle:User', 'user');
|
||||
});
|
||||
return $qb->addSelect('COUNT(user.id) as export')
|
||||
->from('ChillMainBundle:User', 'user');
|
||||
});
|
||||
//$export->initiateQuery()->shouldBeCalled();
|
||||
$export->supportsModifiers()->willReturn(['foo']);
|
||||
$export->requiredRole()->willReturn(new Role('CHILL_STAT_DUMMY'));
|
||||
@ -254,7 +254,7 @@ class ExportManagerTest extends KernelTestCase
|
||||
Argument::Type('array')
|
||||
)
|
||||
->willReturn(function ($value) {
|
||||
switch ($value) {
|
||||
switch ($value) {
|
||||
case 0:
|
||||
case 1:
|
||||
return $value;
|
||||
@ -264,7 +264,7 @@ class ExportManagerTest extends KernelTestCase
|
||||
|
||||
default: throw new RuntimeException(sprintf('The value %s is not valid', $value));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$export->getQueryKeys(Argument::Type('array'))->willReturn(['export']);
|
||||
$export->getTitle()->willReturn('dummy title');
|
||||
@ -294,7 +294,7 @@ class ExportManagerTest extends KernelTestCase
|
||||
Argument::is([])
|
||||
)
|
||||
->willReturn(function ($value) {
|
||||
switch ($value) {
|
||||
switch ($value) {
|
||||
case '_header': return 'foo_header';
|
||||
|
||||
case 'cat a': return 'label cat a';
|
||||
@ -304,7 +304,7 @@ class ExportManagerTest extends KernelTestCase
|
||||
default:
|
||||
throw new RuntimeException(sprintf('This value (%s) is not valid', $value));
|
||||
}
|
||||
});
|
||||
});
|
||||
$aggregator->addRole()->willReturn(null);
|
||||
//$aggregator->addRole()->shouldBeCalled();
|
||||
$exportManager->addAggregator($aggregator->reveal(), 'aggregator_foo');
|
||||
|
@ -136,8 +136,7 @@ class PaginatorTest extends KernelTestCase
|
||||
$itemPerpage,
|
||||
$pageNumber,
|
||||
$expectedHasPage
|
||||
)
|
||||
{
|
||||
) {
|
||||
$paginator = $this->generatePaginator($totalItems, $itemPerpage);
|
||||
|
||||
$this->assertEquals($expectedHasPage, $paginator->hasPage($pageNumber));
|
||||
|
@ -30,9 +30,9 @@ use function array_map;
|
||||
*/
|
||||
class AuthorizationHelperTest extends KernelTestCase
|
||||
{
|
||||
use PrepareUserTrait;
|
||||
use PrepareCenterTrait;
|
||||
use PrepareScopeTrait;
|
||||
use PrepareUserTrait;
|
||||
use ProphecyTrait;
|
||||
|
||||
public function setUp()
|
||||
@ -247,8 +247,7 @@ class AuthorizationHelperTest extends KernelTestCase
|
||||
Role $role,
|
||||
Center $center,
|
||||
$message
|
||||
)
|
||||
{
|
||||
) {
|
||||
$reachableScopes = $this->getAuthorizationHelper()
|
||||
->getReachableScopes($user, $role, $center);
|
||||
|
||||
|
@ -27,8 +27,7 @@ class TestHelper
|
||||
public static function getAuthenticatedClientOptions(
|
||||
$username = 'center a_social',
|
||||
$password = 'password'
|
||||
)
|
||||
{
|
||||
) {
|
||||
return [
|
||||
'PHP_AUTH_USER' => $username,
|
||||
'PHP_AUTH_PW' => $password,
|
||||
|
@ -39,8 +39,7 @@ class RoleScopeScopePresence extends ConstraintValidator
|
||||
RoleProvider $roleProvider,
|
||||
LoggerInterface $logger,
|
||||
TranslatorInterface $translator
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->roleProvider = $roleProvider;
|
||||
$this->logger = $logger;
|
||||
$this->translator = $translator;
|
||||
|
@ -616,12 +616,12 @@ final class ImportPeopleFromCSVCommand extends Command
|
||||
$helper = $this->getHelper('question');
|
||||
$question = new ChoiceQuestion(
|
||||
sprintf(
|
||||
'Which postal code match the '
|
||||
'Which postal code match the '
|
||||
. 'name "%s" with postal code "%s" ? (default to "%s")',
|
||||
$locality,
|
||||
$postalCode,
|
||||
$names[0]
|
||||
),
|
||||
$locality,
|
||||
$postalCode,
|
||||
$names[0]
|
||||
),
|
||||
$names,
|
||||
0
|
||||
);
|
||||
@ -908,11 +908,11 @@ final class ImportPeopleFromCSVCommand extends Command
|
||||
|
||||
$this->output->writeln(
|
||||
sprintf(
|
||||
'You have selected "%s"',
|
||||
is_array($answers[$matchingTableRowAnswer[$selected]]) ?
|
||||
'You have selected "%s"',
|
||||
is_array($answers[$matchingTableRowAnswer[$selected]]) ?
|
||||
implode(',', $answers[$matchingTableRowAnswer[$selected]]) :
|
||||
$answers[$matchingTableRowAnswer[$selected]]
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// recording value in cache
|
||||
@ -933,10 +933,10 @@ final class ImportPeopleFromCSVCommand extends Command
|
||||
|
||||
$this->logger->debug(
|
||||
sprintf(
|
||||
"Found value : %s for custom field with question '%s'",
|
||||
is_array($value) ? implode(',', $value) : $value,
|
||||
$this->helper->localize($cf->getName())
|
||||
)
|
||||
"Found value : %s for custom field with question '%s'",
|
||||
is_array($value) ? implode(',', $value) : $value,
|
||||
$this->helper->localize($cf->getName())
|
||||
)
|
||||
);
|
||||
|
||||
return $value;
|
||||
|
@ -64,9 +64,9 @@ class AccompanyingCourseWorkController extends AbstractController
|
||||
$this->addFlash(
|
||||
'error',
|
||||
$this->trans->trans(
|
||||
'accompanying_work.You must add at least ' .
|
||||
'accompanying_work.You must add at least ' .
|
||||
'one social issue on accompanying period'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return $this->redirectToRoute('chill_person_accompanying_course_index', [
|
||||
|
@ -296,7 +296,7 @@ class AccompanyingPeriodController extends AbstractController
|
||||
->add(
|
||||
'error',
|
||||
$this->get('translator')
|
||||
->trans('Period not opened : form is invalid')
|
||||
->trans('Period not opened : form is invalid')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class LoadHouseholdPosition extends Fixture
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
foreach (self::POSITIONS_DATA as [$name, $share, $allowHolder,
|
||||
$ordering, $ref]) {
|
||||
$ordering, $ref, ]) {
|
||||
$position = (new Position())
|
||||
->setLabel(['fr' => $name])
|
||||
->setAllowHolder($allowHolder)
|
||||
|
@ -857,8 +857,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
$container->prependExtensionConfig(
|
||||
'chill_custom_fields',
|
||||
['customizables_entities' => [
|
||||
['class' => 'Chill\PersonBundle\Entity\Person', 'name' => 'PersonEntity'],
|
||||
],
|
||||
['class' => 'Chill\PersonBundle\Entity\Person', 'name' => 'PersonEntity'],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -45,14 +45,14 @@ class Configuration implements ConfigurationInterface
|
||||
->defaultValue('P1D')
|
||||
->validate()
|
||||
->ifTrue(function ($period) {
|
||||
try {
|
||||
$interval = new DateInterval($period);
|
||||
} catch (Exception $ex) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
$interval = new DateInterval($period);
|
||||
} catch (Exception $ex) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
return false;
|
||||
})
|
||||
->thenInvalid('Invalid period for birthdate validation : "%s" '
|
||||
. 'The parameter should match duration as defined by ISO8601 : '
|
||||
. 'https://en.wikipedia.org/wiki/ISO_8601#Durations')
|
||||
|
@ -197,7 +197,9 @@ class Household
|
||||
}
|
||||
|
||||
return -1;
|
||||
} elseif ($b->getPosition() === null) {
|
||||
}
|
||||
|
||||
if ($b->getPosition() === null) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -119,14 +119,14 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
|
||||
$this->assertTrue(
|
||||
$this->client->getResponse()->isRedirect(
|
||||
'/fr/person/' . $this->person->getId() . '/accompanying-period'
|
||||
),
|
||||
'/fr/person/' . $this->person->getId() . '/accompanying-period'
|
||||
),
|
||||
'the server redirects to /accompanying-period page'
|
||||
);
|
||||
$this->assertGreaterThan(
|
||||
0,
|
||||
$this->client->followRedirect()
|
||||
->filter('.alert-success')->count(),
|
||||
->filter('.alert-success')->count(),
|
||||
"a 'success' element is shown"
|
||||
);
|
||||
}
|
||||
@ -159,14 +159,14 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
|
||||
$this->assertTrue(
|
||||
$this->client->getResponse()->isRedirect(
|
||||
'/fr/person/' . $this->person->getId() . '/accompanying-period'
|
||||
),
|
||||
'/fr/person/' . $this->person->getId() . '/accompanying-period'
|
||||
),
|
||||
'the server redirects to /accompanying-period page'
|
||||
);
|
||||
$this->assertGreaterThan(
|
||||
0,
|
||||
$this->client->followRedirect()
|
||||
->filter('.alert-success')->count(),
|
||||
->filter('.alert-success')->count(),
|
||||
"a 'success' element is shown"
|
||||
);
|
||||
}
|
||||
@ -204,7 +204,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
$this->assertGreaterThan(
|
||||
0,
|
||||
$crawlerResponse
|
||||
->filter('.alert-danger')->count(),
|
||||
->filter('.alert-danger')->count(),
|
||||
"an '.alert-danger' element is shown"
|
||||
);
|
||||
}
|
||||
@ -473,10 +473,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
$this->client->request(
|
||||
'GET',
|
||||
sprintf(
|
||||
'/fr/person/%d/accompanying-period/%d/re-open',
|
||||
$this->person->getId(),
|
||||
$this->person->getOpenedAccompanyingPeriod()->getId()
|
||||
)
|
||||
'/fr/person/%d/accompanying-period/%d/re-open',
|
||||
$this->person->getId(),
|
||||
$this->person->getOpenedAccompanyingPeriod()->getId()
|
||||
)
|
||||
);
|
||||
$this->assertEquals(
|
||||
400,
|
||||
|
@ -117,15 +117,15 @@ class PersonAddressControllerTest extends WebTestCase
|
||||
$this->assertEquals(
|
||||
1,
|
||||
$crawler
|
||||
->filter('div.flash_message.success')
|
||||
->count(),
|
||||
->filter('div.flash_message.success')
|
||||
->count(),
|
||||
'Asserting that the response page contains a success flash message'
|
||||
);
|
||||
$this->assertEquals(
|
||||
1,
|
||||
$crawler
|
||||
->filter('td:contains("Rue de la Paix, 50")')
|
||||
->count(),
|
||||
->filter('td:contains("Rue de la Paix, 50")')
|
||||
->count(),
|
||||
'Asserting that the page contains the new address'
|
||||
);
|
||||
}
|
||||
@ -140,7 +140,7 @@ class PersonAddressControllerTest extends WebTestCase
|
||||
$this->assertEquals(
|
||||
1,
|
||||
$crawler->filter('td:contains("Pas d\'adresse renseignée")')
|
||||
->count(),
|
||||
->count(),
|
||||
"assert that a message say 'no address given'"
|
||||
);
|
||||
}
|
||||
@ -175,15 +175,15 @@ class PersonAddressControllerTest extends WebTestCase
|
||||
$this->assertGreaterThan(
|
||||
0,
|
||||
$crawler
|
||||
->filter('div.flash_message.success')
|
||||
->count(),
|
||||
->filter('div.flash_message.success')
|
||||
->count(),
|
||||
'Asserting that the response page contains a success flash message'
|
||||
);
|
||||
$this->assertEquals(
|
||||
1,
|
||||
$crawler
|
||||
->filter('td:contains("Rue du Trou Normand")')
|
||||
->count(),
|
||||
->filter('td:contains("Rue du Trou Normand")')
|
||||
->count(),
|
||||
'Asserting that the page contains the new address'
|
||||
);
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||
*/
|
||||
class PersonVoterTest extends KernelTestCase
|
||||
{
|
||||
use PrepareUserTrait;
|
||||
use PrepareCenterTrait;
|
||||
use PrepareScopeTrait;
|
||||
use PrepareUserTrait;
|
||||
|
||||
/**
|
||||
* @var \Prophecy\Prophet
|
||||
|
@ -22,8 +22,7 @@ class AddAPersonWidget implements WidgetInterface
|
||||
$place,
|
||||
array $context,
|
||||
array $config
|
||||
)
|
||||
{
|
||||
) {
|
||||
return $env->render('ChillPersonBundle:Widget:homepage_add_a_person.html.twig');
|
||||
}
|
||||
}
|
||||
|
@ -59,8 +59,7 @@ class LoadCustomFieldsGroup extends AbstractFixture implements OrderedFixtureInt
|
||||
ObjectManager $manager,
|
||||
array $name,
|
||||
array $options = []
|
||||
)
|
||||
{
|
||||
) {
|
||||
echo $name['fr'] . " \n";
|
||||
|
||||
$cFGroup = (new CustomFieldsGroup())
|
||||
|
@ -38,19 +38,19 @@ class ChillReportExtension extends Extension implements PrependExtensionInterfac
|
||||
$container->prependExtensionConfig(
|
||||
'chill_custom_fields',
|
||||
['customizables_entities' => [
|
||||
[
|
||||
'class' => 'Chill\ReportBundle\Entity\Report',
|
||||
'name' => 'ReportEntity',
|
||||
'options' => [
|
||||
'summary_fields' => [
|
||||
'form_type' => LinkedCustomFieldsType::class,
|
||||
'form_options' => [
|
||||
'multiple' => true,
|
||||
'expanded' => false,
|
||||
],
|
||||
[
|
||||
'class' => 'Chill\ReportBundle\Entity\Report',
|
||||
'name' => 'ReportEntity',
|
||||
'options' => [
|
||||
'summary_fields' => [
|
||||
'form_type' => LinkedCustomFieldsType::class,
|
||||
'form_options' => [
|
||||
'multiple' => true,
|
||||
'expanded' => false,
|
||||
],
|
||||
], ],
|
||||
],
|
||||
],
|
||||
], ],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -49,8 +49,7 @@ class ReportType extends AbstractType
|
||||
TokenStorageInterface $tokenStorage,
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
ObjectManager $om
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->authorizationHelper = $helper;
|
||||
$this->user = $tokenStorage->getToken()->getUser();
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
|
@ -46,8 +46,7 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface
|
||||
EntityManagerInterface $em,
|
||||
AuthorizationHelper $helper,
|
||||
TokenStorageInterface $tokenStorage
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->helper = $helper;
|
||||
|
||||
@ -99,9 +98,9 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface
|
||||
);
|
||||
$whereElement->add(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->eq('p.center', ':center_' . $i),
|
||||
$qb->expr()->in('r.scope', ':reachable_scopes_' . $i)
|
||||
)
|
||||
$qb->expr()->eq('p.center', ':center_' . $i),
|
||||
$qb->expr()->in('r.scope', ':reachable_scopes_' . $i)
|
||||
)
|
||||
);
|
||||
$qb->setParameter('center_' . $i, $center);
|
||||
$qb->setParameter('reachable_scopes_' . $i, $reachableScopesId);
|
||||
|
@ -66,8 +66,8 @@ class ReportControllerNextTest extends WebTestCase
|
||||
$filteredCustomFieldsGroupHouse = array_filter(
|
||||
$customFieldsGroups,
|
||||
function (CustomFieldsGroup $group) {
|
||||
return in_array('Situation de logement', $group->getName());
|
||||
}
|
||||
return in_array('Situation de logement', $group->getName());
|
||||
}
|
||||
);
|
||||
$this->group = $filteredCustomFieldsGroupHouse[0];
|
||||
}
|
||||
|
@ -83,8 +83,8 @@ class ReportControllerTest extends WebTestCase
|
||||
$filteredCustomFieldsGroupHouse = array_filter(
|
||||
$customFieldsGroups,
|
||||
function (CustomFieldsGroup $group) {
|
||||
return in_array('Situation de logement', $group->getName());
|
||||
}
|
||||
return in_array('Situation de logement', $group->getName());
|
||||
}
|
||||
);
|
||||
static::$group = $filteredCustomFieldsGroupHouse[0];
|
||||
|
||||
@ -136,7 +136,7 @@ class ReportControllerTest extends WebTestCase
|
||||
$this->assertGreaterThan(
|
||||
1,
|
||||
count($form->get(self::REPORT_NAME_FIELD)
|
||||
->availableOptionValues()),
|
||||
->availableOptionValues()),
|
||||
'I can choose between report models'
|
||||
);
|
||||
|
||||
@ -253,9 +253,9 @@ class ReportControllerTest extends WebTestCase
|
||||
);
|
||||
$this->assertContains(
|
||||
sprintf(
|
||||
'/fr/person/%d/report/select/type/for/creation',
|
||||
static::$person->getId()
|
||||
),
|
||||
'/fr/person/%d/report/select/type/for/creation',
|
||||
static::$person->getId()
|
||||
),
|
||||
$link->getUri(),
|
||||
'There is a "add a report" link in menu'
|
||||
);
|
||||
@ -334,10 +334,10 @@ class ReportControllerTest extends WebTestCase
|
||||
|
||||
$this->assertTrue($client->getResponse()->isRedirect(
|
||||
sprintf(
|
||||
'/fr/person/%s/report/%s/view',
|
||||
static::$person->getId(),
|
||||
$reportId
|
||||
)
|
||||
'/fr/person/%s/report/%s/view',
|
||||
static::$person->getId(),
|
||||
$reportId
|
||||
)
|
||||
));
|
||||
|
||||
$this->assertEquals(new DateTime('yesterday'), static::$kernel->getContainer()
|
||||
@ -416,8 +416,7 @@ class ReportControllerTest extends WebTestCase
|
||||
Person $person,
|
||||
CustomFieldsGroup $group,
|
||||
\Symfony\Component\BrowserKit\Client $client
|
||||
)
|
||||
{
|
||||
) {
|
||||
$url = sprintf(
|
||||
'fr/person/%d/report/cfgroup/%d/new',
|
||||
$person->getId(),
|
||||
|
@ -25,9 +25,9 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||
*/
|
||||
class ReportVoterTest extends KernelTestCase
|
||||
{
|
||||
use PrepareUserTrait;
|
||||
use PrepareCenterTrait;
|
||||
use PrepareScopeTrait;
|
||||
use PrepareUserTrait;
|
||||
|
||||
/**
|
||||
* @var \Prophecy\Prophet
|
||||
@ -131,8 +131,7 @@ class ReportVoterTest extends KernelTestCase
|
||||
$action,
|
||||
$message,
|
||||
?User $user = null
|
||||
)
|
||||
{
|
||||
) {
|
||||
$token = $this->prepareToken($user);
|
||||
$result = $this->voter->vote($token, $report, [$action]);
|
||||
$this->assertEquals($expectedResult, $result, $message);
|
||||
|
@ -62,8 +62,8 @@ class TimelineProviderTest extends WebTestCase
|
||||
|
||||
$scopesSocial = array_filter(
|
||||
static::$em
|
||||
->getRepository('ChillMainBundle:Scope')
|
||||
->findAll(),
|
||||
->getRepository('ChillMainBundle:Scope')
|
||||
->findAll(),
|
||||
function (Scope $scope) { return $scope->getName()['en'] === 'social'; }
|
||||
);
|
||||
|
||||
@ -104,7 +104,7 @@ class TimelineProviderTest extends WebTestCase
|
||||
$this->assertEquals(
|
||||
0,
|
||||
$crawler->filter('.report_entry .summary')
|
||||
->count(),
|
||||
->count(),
|
||||
'the page does not contains a .report .summary element'
|
||||
);
|
||||
}
|
||||
@ -152,19 +152,19 @@ class TimelineProviderTest extends WebTestCase
|
||||
$this->assertGreaterThan(
|
||||
0,
|
||||
$crawler->filter('.report_entry .summary')
|
||||
->count(),
|
||||
->count(),
|
||||
'the page contains a .report .summary element'
|
||||
);
|
||||
$this->assertContains(
|
||||
'blah blah',
|
||||
$crawler->filter('.report_entry .summary')
|
||||
->text(),
|
||||
->text(),
|
||||
'the page contains the text "blah blah"'
|
||||
);
|
||||
$this->assertContains(
|
||||
'Propriétaire',
|
||||
$crawler->filter('.report_entry .summary')
|
||||
->text(),
|
||||
->text(),
|
||||
'the page contains the mention "Propriétaire"'
|
||||
);
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ class TaskController extends AbstractController
|
||||
array_filter(
|
||||
$workflow->getEnabledTransitions($task),
|
||||
function (Transition $t) use ($transition) {
|
||||
return $t->getName() === $transition;
|
||||
}
|
||||
return $t->getName() === $transition;
|
||||
}
|
||||
))[0];
|
||||
|
||||
$form = $this->createTransitionForm($task);
|
||||
|
@ -31,8 +31,7 @@ class MenuBuilder implements LocalMenuBuilderInterface
|
||||
public function __construct(
|
||||
AuthorizationCheckerInterface $authorizationChecker,
|
||||
TranslatorInterface $translator
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
}
|
||||
|
@ -255,8 +255,8 @@ class SingleTaskRepository extends EntityRepository
|
||||
return $qb->expr()->orX()
|
||||
->add(
|
||||
$qb->expr()->andX()
|
||||
->add($qb->expr()->isNotNull('st.endDate'))
|
||||
->add($qb->expr()->gt('st.endDate', ':now'))
|
||||
->add($qb->expr()->isNotNull('st.endDate'))
|
||||
->add($qb->expr()->gt('st.endDate', ':now'))
|
||||
)
|
||||
->add($qb->expr()->isNull('st.endDate'));
|
||||
}
|
||||
@ -281,23 +281,23 @@ class SingleTaskRepository extends EntityRepository
|
||||
return $qb->expr()->andX()
|
||||
->add(
|
||||
$qb->expr()->lte(
|
||||
$qb->expr()->diff('st.endDate', 'st.warningInterval'),
|
||||
':now'
|
||||
)
|
||||
$qb->expr()->diff('st.endDate', 'st.warningInterval'),
|
||||
':now'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $qb->expr()->orX()
|
||||
->add(
|
||||
$qb->expr()->andX()
|
||||
->add($qb->expr()->isNotNull('st.endDate'))
|
||||
->add($qb->expr()->isNotNull('st.warningInterval'))
|
||||
->add(
|
||||
$qb->expr()->gt(
|
||||
$qb->expr()->diff('st.endDate', 'st.warningInterval'),
|
||||
':now'
|
||||
)
|
||||
)
|
||||
->add($qb->expr()->isNotNull('st.endDate'))
|
||||
->add($qb->expr()->isNotNull('st.warningInterval'))
|
||||
->add(
|
||||
$qb->expr()->gt(
|
||||
$qb->expr()->diff('st.endDate', 'st.warningInterval'),
|
||||
':now'
|
||||
)
|
||||
)
|
||||
)
|
||||
->add($qb->expr()->isNull('st.endDate'))
|
||||
->add($qb->expr()->isNull('st.warningInterval'));
|
||||
|
@ -32,8 +32,6 @@ class ThirdPartyTypeManager
|
||||
* Method used during the load of the manager by Dependency Injection
|
||||
*
|
||||
* @param \Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeProviderInterface $provider
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function addProvider(ThirdPartyTypeProviderInterface $provider): self
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user