cs: Second part - ignore test/app subdirectory.

This commit is contained in:
Pol Dellaiera 2021-11-23 14:34:34 +01:00
parent 5f37304796
commit 3ea35682eb
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
72 changed files with 326 additions and 365 deletions

View File

@ -15,6 +15,7 @@ $config = require __DIR__ . '/tests/app/vendor/drupol/php-conventions/config/php
$config $config
->getFinder() ->getFinder()
->ignoreDotFiles(false) ->ignoreDotFiles(false)
->notPath('tests/app')
->name(['.php_cs.dist.php']); ->name(['.php_cs.dist.php']);
$rules = $config->getRules(); $rules = $config->getRules();

View File

@ -29,8 +29,7 @@ namespace Chill\MainBundle\DependencyInjection;
public function __construct( public function __construct(
array $widgetFactories = [], array $widgetFactories = [],
ContainerBuilder $containerBuilder ContainerBuilder $containerBuilder
) ) {
{
// we register here widget factories (see below) // we register here widget factories (see below)
$this->setWidgetFactories($widgetFactories); $this->setWidgetFactories($widgetFactories);
// we will need the container builder later... // we will need the container builder later...

View File

@ -30,8 +30,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
public function __construct( public function __construct(
AuthorizationCheckerInterface $authorizationChecker, AuthorizationCheckerInterface $authorizationChecker,
TranslatorInterface $translator TranslatorInterface $translator
) ) {
{
$this->translator = $translator; $this->translator = $translator;
$this->authorizationChecker = $authorizationChecker; $this->authorizationChecker = $authorizationChecker;
} }

View File

@ -71,8 +71,7 @@ class TranslatableActivityReasonTest extends TypeTestCase
protected function getTranslatableStringHelper( protected function getTranslatableStringHelper(
$locale = 'en', $locale = 'en',
$fallbackLocale = 'en' $fallbackLocale = 'en'
) ) {
{
$prophet = new \Prophecy\Prophet(); $prophet = new \Prophecy\Prophet();
$requestStack = $prophet->prophesize(); $requestStack = $prophet->prophesize();
$request = $prophet->prophesize(); $request = $prophet->prophesize();

View File

@ -26,11 +26,11 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
*/ */
class ActivityVoterTest extends KernelTestCase class ActivityVoterTest extends KernelTestCase
{ {
use PrepareUserTrait;
use PrepareCenterTrait;
use PrepareScopeTrait;
use PreparePersonTrait;
use PrepareActivityTrait; use PrepareActivityTrait;
use PrepareCenterTrait;
use PreparePersonTrait;
use PrepareScopeTrait;
use PrepareUserTrait;
/** /**
* @var \Prophecy\Prophet * @var \Prophecy\Prophet
@ -132,8 +132,7 @@ class ActivityVoterTest extends KernelTestCase
Center $center, Center $center,
$attribute, $attribute,
$message $message
) ) {
{
$token = $this->prepareToken($user); $token = $this->prepareToken($user);
$activity = $this->prepareActivity($scope, $this->preparePerson($center)); $activity = $this->prepareActivity($scope, $this->preparePerson($center));

View File

@ -54,8 +54,7 @@ class CustomFieldChoice extends AbstractCustomField
TranslatorInterface $translator, TranslatorInterface $translator,
TwigEngine $templating, TwigEngine $templating,
TranslatableStringHelper $translatableStringHelper TranslatableStringHelper $translatableStringHelper
) ) {
{
$this->defaultLocales = $translator->getFallbackLocales(); $this->defaultLocales = $translator->getFallbackLocales();
$this->templating = $templating; $this->templating = $templating;
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;

View File

@ -41,8 +41,7 @@ class CustomFieldText extends AbstractCustomField
RequestStack $requestStack, RequestStack $requestStack,
TwigEngine $templating, TwigEngine $templating,
TranslatableStringHelper $translatableStringHelper TranslatableStringHelper $translatableStringHelper
) ) {
{
$this->requestStack = $requestStack; $this->requestStack = $requestStack;
$this->templating = $templating; $this->templating = $templating;
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;

View File

@ -41,8 +41,7 @@ class CustomFieldTitle extends AbstractCustomField
RequestStack $requestStack, RequestStack $requestStack,
TwigEngine $templating, TwigEngine $templating,
TranslatableStringHelper $translatableStringHelper TranslatableStringHelper $translatableStringHelper
) ) {
{
$this->requestStack = $requestStack; $this->requestStack = $requestStack;
$this->templating = $templating; $this->templating = $templating;
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;

View File

@ -25,8 +25,7 @@ class CustomFieldDataTransformer implements DataTransformerInterface
public function __construct( public function __construct(
CustomFieldInterface $customFieldDefinition, CustomFieldInterface $customFieldDefinition,
CustomField $customField CustomField $customField
) ) {
{
$this->customFieldDefinition = $customFieldDefinition; $this->customFieldDefinition = $customFieldDefinition;
$this->customField = $customField; $this->customField = $customField;
} }

View File

@ -39,8 +39,7 @@ class CustomFieldsHelper
public function __construct( public function __construct(
EntityManagerInterface $em, EntityManagerInterface $em,
CustomFieldProvider $provider CustomFieldProvider $provider
) ) {
{
$this->em = $em; $this->em = $em;
$this->provider = $provider; $this->provider = $provider;
} }

View File

@ -137,8 +137,7 @@ class DocGeneratorTemplateController extends AbstractController
public function listTemplateApiAction( public function listTemplateApiAction(
string $entityClassName, string $entityClassName,
DocGeneratorTemplateRepository $templateRepository DocGeneratorTemplateRepository $templateRepository
): Response ): Response {
{
$entities = $templateRepository->findByEntity($entityClassName); $entities = $templateRepository->findByEntity($entityClassName);
$ret = []; $ret = [];

View File

@ -551,8 +551,7 @@ class ParticipationController extends AbstractController
Request $request, Request $request,
Participation $participation, Participation $participation,
bool $multiple = false bool $multiple = false
) ) {
{
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
if ($em->contains($participation)) { if ($em->contains($participation)) {

View File

@ -92,8 +92,7 @@ class EventSearch extends AbstractSearch
$limit = 50, $limit = 50,
array $options = [], array $options = [],
$format = 'html' $format = 'html'
) ) {
{
$total = $this->count($terms); $total = $this->count($terms);
$paginator = $this->paginationFactory->create($total); $paginator = $this->paginationFactory->create($total);

View File

@ -476,8 +476,7 @@ class ParticipationControllerTest extends WebTestCase
protected function getRandomEventWithMultipleParticipations( protected function getRandomEventWithMultipleParticipations(
$centerName = 'Center A', $centerName = 'Center A',
$circleName = 'social' $circleName = 'social'
) ) {
{
$event = $this->getRandomEvent($centerName, $circleName); $event = $this->getRandomEvent($centerName, $circleName);
return $event->getParticipations()->count() > 1 ? return $event->getParticipations()->count() > 1 ?

View File

@ -714,8 +714,7 @@ class CRUDController extends AbstractController
int $totalItems, int $totalItems,
PaginatorInterface $paginator, PaginatorInterface $paginator,
?FilterOrderHelper $filterOrder = null ?FilterOrderHelper $filterOrder = null
) ) {
{
$query = $this->queryEntities($action, $request, $paginator, $filterOrder); $query = $this->queryEntities($action, $request, $paginator, $filterOrder);
return $query->getQuery()->getResult(); return $query->getQuery()->getResult();

View File

@ -206,6 +206,7 @@ class ExportController extends AbstractController
* *
* @param string $alias * @param string $alias
* @param array $data the data from previous step. Required for steps 'formatter' and 'generate_formatter' * @param array $data the data from previous step. Required for steps 'formatter' and 'generate_formatter'
* @param mixed $step
* *
* @return \Symfony\Component\Form\Form * @return \Symfony\Component\Form\Form
*/ */

View File

@ -35,8 +35,7 @@ class NotificationController extends AbstractController
NotificationRepository $notificationRepository, NotificationRepository $notificationRepository,
NotificationRenderer $notificationRenderer, NotificationRenderer $notificationRenderer,
PaginatorFactory $paginatorFactory PaginatorFactory $paginatorFactory
) ) {
{
$currentUser = $this->security->getUser(); $currentUser = $this->security->getUser();
$notificationsNbr = $notificationRepository->countAllForAttendee(($currentUser)); $notificationsNbr = $notificationRepository->countAllForAttendee(($currentUser));

View File

@ -526,8 +526,7 @@ class PermissionsGroupController extends AbstractController
private function createDeleteRoleScopeForm( private function createDeleteRoleScopeForm(
PermissionsGroup $permissionsGroup, PermissionsGroup $permissionsGroup,
RoleScope $roleScope RoleScope $roleScope
) ) {
{
return $this->createFormBuilder() return $this->createFormBuilder()
->setAction($this->generateUrl( ->setAction($this->generateUrl(
'admin_permissionsgroup_delete_role_scope', 'admin_permissionsgroup_delete_role_scope',

View File

@ -47,8 +47,7 @@ class ExportsCompilerPass implements CompilerPassInterface
private function compileAggregators( private function compileAggregators(
Definition $chillManagerDefinition, Definition $chillManagerDefinition,
ContainerBuilder $container ContainerBuilder $container
) ) {
{
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(
'chill.export_aggregator' 'chill.export_aggregator'
); );
@ -79,8 +78,7 @@ class ExportsCompilerPass implements CompilerPassInterface
private function compileExportElementsProvider( private function compileExportElementsProvider(
Definition $chillManagerDefinition, Definition $chillManagerDefinition,
ContainerBuilder $container ContainerBuilder $container
) ) {
{
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(
'chill.export_elements_provider' 'chill.export_elements_provider'
); );
@ -111,8 +109,7 @@ class ExportsCompilerPass implements CompilerPassInterface
private function compileExports( private function compileExports(
Definition $chillManagerDefinition, Definition $chillManagerDefinition,
ContainerBuilder $container ContainerBuilder $container
) ) {
{
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(
'chill.export' 'chill.export'
); );
@ -143,8 +140,7 @@ class ExportsCompilerPass implements CompilerPassInterface
private function compileFilters( private function compileFilters(
Definition $chillManagerDefinition, Definition $chillManagerDefinition,
ContainerBuilder $container ContainerBuilder $container
) ) {
{
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(
'chill.export_filter' 'chill.export_filter'
); );
@ -175,8 +171,7 @@ class ExportsCompilerPass implements CompilerPassInterface
private function compileFormatters( private function compileFormatters(
Definition $chillManagerDefinition, Definition $chillManagerDefinition,
ContainerBuilder $container ContainerBuilder $container
) ) {
{
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(
'chill.export_formatter' 'chill.export_formatter'
); );

View File

@ -27,8 +27,7 @@ class Configuration implements ConfigurationInterface
public function __construct( public function __construct(
array $widgetFactories, array $widgetFactories,
ContainerBuilder $containerBuilder ContainerBuilder $containerBuilder
) ) {
{
$this->setWidgetFactories($widgetFactories); $this->setWidgetFactories($widgetFactories);
$this->containerBuilder = $containerBuilder; $this->containerBuilder = $containerBuilder;
} }

View File

@ -92,8 +92,7 @@ class ExportManager
AuthorizationCheckerInterface $authorizationChecker, AuthorizationCheckerInterface $authorizationChecker,
AuthorizationHelper $authorizationHelper, AuthorizationHelper $authorizationHelper,
TokenStorageInterface $tokenStorage TokenStorageInterface $tokenStorage
) ) {
{
$this->logger = $logger; $this->logger = $logger;
$this->em = $em; $this->em = $em;
$this->authorizationChecker = $authorizationChecker; $this->authorizationChecker = $authorizationChecker;
@ -602,8 +601,7 @@ class ExportManager
QueryBuilder $qb, QueryBuilder $qb,
$data, $data,
array $center array $center
) ) {
{
$aggregators = $this->retrieveUsedAggregators($data); $aggregators = $this->retrieveUsedAggregators($data);
foreach ($aggregators as $alias => $aggregator) { foreach ($aggregators as $alias => $aggregator) {
@ -626,8 +624,7 @@ class ExportManager
QueryBuilder $qb, QueryBuilder $qb,
$data, $data,
array $centers array $centers
) ) {
{
$filters = $this->retrieveUsedFilters($data); $filters = $this->retrieveUsedFilters($data);
foreach ($filters as $alias => $filter) { foreach ($filters as $alias => $filter) {

View File

@ -55,8 +55,7 @@ class CSVFormatter implements FormatterInterface
public function __construct( public function __construct(
TranslatorInterface $translator, TranslatorInterface $translator,
ExportManager $manager ExportManager $manager
) ) {
{
$this->translator = $translator; $this->translator = $translator;
$this->exportManager = $manager; $this->exportManager = $manager;
} }

View File

@ -102,8 +102,7 @@ trait AppendScopeChoiceTypeTrait
TranslatableStringHelper $translatableStringHelper, TranslatableStringHelper $translatableStringHelper,
ObjectManager $om, ObjectManager $om,
$name = 'scope' $name = 'scope'
) ) {
{
$reachableScopes = $authorizationHelper $reachableScopes = $authorizationHelper
->getReachableScopes($user, $role, $center); ->getReachableScopes($user, $role, $center);

View File

@ -58,8 +58,7 @@ class PickCenterType extends AbstractType
TokenStorageInterface $tokenStorage, TokenStorageInterface $tokenStorage,
ExportManager $exportManager, ExportManager $exportManager,
AuthorizationHelper $authorizationHelper AuthorizationHelper $authorizationHelper
) ) {
{
$this->exportManager = $exportManager; $this->exportManager = $exportManager;
$this->user = $tokenStorage->getToken()->getUser(); $this->user = $tokenStorage->getToken()->getUser();
$this->authorizationHelper = $authorizationHelper; $this->authorizationHelper = $authorizationHelper;

View File

@ -21,8 +21,7 @@ final class NotificationRenderer
public function __construct( public function __construct(
AccompanyingPeriodNotificationRenderer $accompanyingPeriodNotificationRenderer, AccompanyingPeriodNotificationRenderer $accompanyingPeriodNotificationRenderer,
ActivityNotificationRenderer $activityNotificationRenderer ActivityNotificationRenderer $activityNotificationRenderer
) ) {
{
// TODO configure automatically // TODO configure automatically
// TODO CREER UNE INTERFACE POUR ETRE SUR QUE LES RENDERERS SONT OK // TODO CREER UNE INTERFACE POUR ETRE SUR QUE LES RENDERERS SONT OK

View File

@ -138,8 +138,7 @@ class SearchProvider
$limit = 50, $limit = 50,
array $options = [], array $options = [],
$format = 'html' $format = 'html'
) ) {
{
$terms = $this->parse($pattern); $terms = $this->parse($pattern);
$search = $this->getByName($name); $search = $this->getByName($name);
@ -169,8 +168,7 @@ class SearchProvider
$limit = 50, $limit = 50,
array $options = [], array $options = [],
$format = 'html' $format = 'html'
) ) {
{
$terms = $this->parse($pattern); $terms = $this->parse($pattern);
$results = []; $results = [];

View File

@ -35,6 +35,7 @@ class AddressRender implements ChillEntityRenderInterface
/** /**
* @param Address addr * @param Address addr
* @param mixed $addr
*/ */
public function renderBox($addr, array $options): string public function renderBox($addr, array $options): string
{ {

View File

@ -136,8 +136,7 @@ class PaginatorTest extends KernelTestCase
$itemPerpage, $itemPerpage,
$pageNumber, $pageNumber,
$expectedHasPage $expectedHasPage
) ) {
{
$paginator = $this->generatePaginator($totalItems, $itemPerpage); $paginator = $this->generatePaginator($totalItems, $itemPerpage);
$this->assertEquals($expectedHasPage, $paginator->hasPage($pageNumber)); $this->assertEquals($expectedHasPage, $paginator->hasPage($pageNumber));

View File

@ -30,9 +30,9 @@ use function array_map;
*/ */
class AuthorizationHelperTest extends KernelTestCase class AuthorizationHelperTest extends KernelTestCase
{ {
use PrepareUserTrait;
use PrepareCenterTrait; use PrepareCenterTrait;
use PrepareScopeTrait; use PrepareScopeTrait;
use PrepareUserTrait;
use ProphecyTrait; use ProphecyTrait;
public function setUp() public function setUp()
@ -247,8 +247,7 @@ class AuthorizationHelperTest extends KernelTestCase
Role $role, Role $role,
Center $center, Center $center,
$message $message
) ) {
{
$reachableScopes = $this->getAuthorizationHelper() $reachableScopes = $this->getAuthorizationHelper()
->getReachableScopes($user, $role, $center); ->getReachableScopes($user, $role, $center);

View File

@ -27,8 +27,7 @@ class TestHelper
public static function getAuthenticatedClientOptions( public static function getAuthenticatedClientOptions(
$username = 'center a_social', $username = 'center a_social',
$password = 'password' $password = 'password'
) ) {
{
return [ return [
'PHP_AUTH_USER' => $username, 'PHP_AUTH_USER' => $username,
'PHP_AUTH_PW' => $password, 'PHP_AUTH_PW' => $password,

View File

@ -39,8 +39,7 @@ class RoleScopeScopePresence extends ConstraintValidator
RoleProvider $roleProvider, RoleProvider $roleProvider,
LoggerInterface $logger, LoggerInterface $logger,
TranslatorInterface $translator TranslatorInterface $translator
) ) {
{
$this->roleProvider = $roleProvider; $this->roleProvider = $roleProvider;
$this->logger = $logger; $this->logger = $logger;
$this->translator = $translator; $this->translator = $translator;

View File

@ -30,7 +30,7 @@ class LoadHouseholdPosition extends Fixture
public function load(ObjectManager $manager) public function load(ObjectManager $manager)
{ {
foreach (self::POSITIONS_DATA as [$name, $share, $allowHolder, foreach (self::POSITIONS_DATA as [$name, $share, $allowHolder,
$ordering, $ref]) { $ordering, $ref, ]) {
$position = (new Position()) $position = (new Position())
->setLabel(['fr' => $name]) ->setLabel(['fr' => $name])
->setAllowHolder($allowHolder) ->setAllowHolder($allowHolder)

View File

@ -197,7 +197,9 @@ class Household
} }
return -1; return -1;
} elseif ($b->getPosition() === null) { }
if ($b->getPosition() === null) {
return 1; return 1;
} }

View File

@ -26,9 +26,9 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
*/ */
class PersonVoterTest extends KernelTestCase class PersonVoterTest extends KernelTestCase
{ {
use PrepareUserTrait;
use PrepareCenterTrait; use PrepareCenterTrait;
use PrepareScopeTrait; use PrepareScopeTrait;
use PrepareUserTrait;
/** /**
* @var \Prophecy\Prophet * @var \Prophecy\Prophet

View File

@ -22,8 +22,7 @@ class AddAPersonWidget implements WidgetInterface
$place, $place,
array $context, array $context,
array $config array $config
) ) {
{
return $env->render('ChillPersonBundle:Widget:homepage_add_a_person.html.twig'); return $env->render('ChillPersonBundle:Widget:homepage_add_a_person.html.twig');
} }
} }

View File

@ -59,8 +59,7 @@ class LoadCustomFieldsGroup extends AbstractFixture implements OrderedFixtureInt
ObjectManager $manager, ObjectManager $manager,
array $name, array $name,
array $options = [] array $options = []
) ) {
{
echo $name['fr'] . " \n"; echo $name['fr'] . " \n";
$cFGroup = (new CustomFieldsGroup()) $cFGroup = (new CustomFieldsGroup())

View File

@ -49,8 +49,7 @@ class ReportType extends AbstractType
TokenStorageInterface $tokenStorage, TokenStorageInterface $tokenStorage,
TranslatableStringHelper $translatableStringHelper, TranslatableStringHelper $translatableStringHelper,
ObjectManager $om ObjectManager $om
) ) {
{
$this->authorizationHelper = $helper; $this->authorizationHelper = $helper;
$this->user = $tokenStorage->getToken()->getUser(); $this->user = $tokenStorage->getToken()->getUser();
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;

View File

@ -46,8 +46,7 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface
EntityManagerInterface $em, EntityManagerInterface $em,
AuthorizationHelper $helper, AuthorizationHelper $helper,
TokenStorageInterface $tokenStorage TokenStorageInterface $tokenStorage
) ) {
{
$this->em = $em; $this->em = $em;
$this->helper = $helper; $this->helper = $helper;

View File

@ -416,8 +416,7 @@ class ReportControllerTest extends WebTestCase
Person $person, Person $person,
CustomFieldsGroup $group, CustomFieldsGroup $group,
\Symfony\Component\BrowserKit\Client $client \Symfony\Component\BrowserKit\Client $client
) ) {
{
$url = sprintf( $url = sprintf(
'fr/person/%d/report/cfgroup/%d/new', 'fr/person/%d/report/cfgroup/%d/new',
$person->getId(), $person->getId(),

View File

@ -25,9 +25,9 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
*/ */
class ReportVoterTest extends KernelTestCase class ReportVoterTest extends KernelTestCase
{ {
use PrepareUserTrait;
use PrepareCenterTrait; use PrepareCenterTrait;
use PrepareScopeTrait; use PrepareScopeTrait;
use PrepareUserTrait;
/** /**
* @var \Prophecy\Prophet * @var \Prophecy\Prophet
@ -131,8 +131,7 @@ class ReportVoterTest extends KernelTestCase
$action, $action,
$message, $message,
?User $user = null ?User $user = null
) ) {
{
$token = $this->prepareToken($user); $token = $this->prepareToken($user);
$result = $this->voter->vote($token, $report, [$action]); $result = $this->voter->vote($token, $report, [$action]);
$this->assertEquals($expectedResult, $result, $message); $this->assertEquals($expectedResult, $result, $message);

View File

@ -31,8 +31,7 @@ class MenuBuilder implements LocalMenuBuilderInterface
public function __construct( public function __construct(
AuthorizationCheckerInterface $authorizationChecker, AuthorizationCheckerInterface $authorizationChecker,
TranslatorInterface $translator TranslatorInterface $translator
) ) {
{
$this->translator = $translator; $this->translator = $translator;
$this->authorizationChecker = $authorizationChecker; $this->authorizationChecker = $authorizationChecker;
} }

View File

@ -32,8 +32,6 @@ class ThirdPartyTypeManager
* Method used during the load of the manager by Dependency Injection * Method used during the load of the manager by Dependency Injection
* *
* @param \Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeProviderInterface $provider * @param \Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeProviderInterface $provider
*
* @return self
*/ */
public function addProvider(ThirdPartyTypeProviderInterface $provider): self public function addProvider(ThirdPartyTypeProviderInterface $provider): self
{ {