mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-31 12:03:48 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -13,12 +13,12 @@ namespace Chill\EventBundle\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Test the creation of participation controller.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ParticipationControllerTest extends WebTestCase
|
||||
@@ -83,7 +83,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
400,
|
||||
$this->client->getResponse()->getStatusCode(),
|
||||
'Test that /fr/event/participation/create fail if '
|
||||
. 'both person_id and persons_ids are missing'
|
||||
.'both person_id and persons_ids are missing'
|
||||
);
|
||||
|
||||
// having both person_id and persons_ids
|
||||
@@ -103,7 +103,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
400,
|
||||
$this->client->getResponse()->getStatusCode(),
|
||||
'test that /fr/event/participation/create fail if both person_id and '
|
||||
. 'persons_ids are set'
|
||||
.'persons_ids are set'
|
||||
);
|
||||
|
||||
// missing event_id
|
||||
@@ -141,7 +141,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
/** @var \Chill\EventBundle\Entity\Event $event */
|
||||
$event = $this->getRandomEventWithMultipleParticipations();
|
||||
|
||||
$crawler = $this->client->request('GET', '/fr/event/participation/' . $event->getId() .
|
||||
$crawler = $this->client->request('GET', '/fr/event/participation/'.$event->getId().
|
||||
'/edit_multiple');
|
||||
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
@@ -157,7 +157,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
]);
|
||||
|
||||
$this->assertTrue($this->client->getResponse()
|
||||
->isRedirect('/fr/event/event/' . $event->getId() . '/show'));
|
||||
->isRedirect('/fr/event/event/'.$event->getId().'/show'));
|
||||
}
|
||||
|
||||
public function testNewActionWrongParameters()
|
||||
@@ -177,7 +177,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
400,
|
||||
$this->client->getResponse()->getStatusCode(),
|
||||
'Test that /fr/event/participation/new fail if '
|
||||
. 'both person_id and persons_ids are missing'
|
||||
.'both person_id and persons_ids are missing'
|
||||
);
|
||||
|
||||
// having both person_id and persons_ids
|
||||
@@ -197,7 +197,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
400,
|
||||
$this->client->getResponse()->getStatusCode(),
|
||||
'test that /fr/event/participation/new fail if both person_id and '
|
||||
. 'persons_ids are set'
|
||||
.'persons_ids are set'
|
||||
);
|
||||
|
||||
// missing event_id
|
||||
@@ -285,11 +285,11 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
$crawler = $this->client->followRedirect();
|
||||
|
||||
$span1 = $crawler->filter('table td span.entity-person a:contains("'
|
||||
. $person1->getFirstName() . '"):contains("' . $person1->getLastname() . '")');
|
||||
$this->assertGreaterThan(0, count($span1));
|
||||
.$person1->getFirstName().'"):contains("'.$person1->getLastname().'")');
|
||||
$this->assertGreaterThan(0, \count($span1));
|
||||
$span2 = $crawler->filter('table td span.entity-person a:contains("'
|
||||
. $person2->getFirstName() . '"):contains("' . $person2->getLastname() . '")');
|
||||
$this->assertGreaterThan(0, count($span2));
|
||||
.$person2->getFirstName().'"):contains("'.$person2->getLastname().'")');
|
||||
$this->assertGreaterThan(0, \count($span2));
|
||||
|
||||
// as the container has reloaded, reload the event
|
||||
$event = $this->em->getRepository(\Chill\EventBundle\Entity\Event::class)->find($event->getId());
|
||||
@@ -338,10 +338,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
$newPerson = $this->getRandomPerson();
|
||||
|
||||
// build the `persons_ids` parameter
|
||||
$persons_ids_string = implode(',', array_merge(
|
||||
$persons_id,
|
||||
[$newPerson->getId()]
|
||||
));
|
||||
$persons_ids_string = implode(',', [...$persons_id, $newPerson->getId()]);
|
||||
|
||||
$crawler = $this->client->request(
|
||||
'GET',
|
||||
@@ -360,8 +357,8 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
|
||||
// count that the one UL contains the new person string
|
||||
$firstPerson = $event->getParticipations()->first()->getPerson();
|
||||
$ul = $crawler->filter('ul:contains("' . $firstPerson->getLastName() . '")'
|
||||
. ':contains("' . $firstPerson->getFirstName() . '")');
|
||||
$ul = $crawler->filter('ul:contains("'.$firstPerson->getLastName().'")'
|
||||
.':contains("'.$firstPerson->getFirstName().'")');
|
||||
|
||||
$this->assertEquals(
|
||||
1,
|
||||
@@ -434,9 +431,9 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
$crawler = $this->client->followRedirect();
|
||||
|
||||
$span = $crawler->filter('table td span.entity-person a:contains("'
|
||||
. $person->getFirstName() . '"):contains("' . $person->getLastname() . '")');
|
||||
.$person->getFirstName().'"):contains("'.$person->getLastname().'")');
|
||||
|
||||
$this->assertGreaterThan(0, count($span));
|
||||
$this->assertGreaterThan(0, \count($span));
|
||||
|
||||
// as the container has reloaded, reload the event
|
||||
$event = $this->em->getRepository(\Chill\EventBundle\Entity\Event::class)->find($event->getId());
|
||||
@@ -446,7 +443,6 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \Chill\EventBundle\Entity\Event
|
||||
*/
|
||||
protected function getRandomEvent(mixed $centerName = 'Center A', mixed $circleName = 'social')
|
||||
@@ -456,7 +452,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
|
||||
$circles = $this->em->getRepository(\Chill\MainBundle\Entity\Scope::class)
|
||||
->findAll();
|
||||
array_filter($circles, static fn ($circle) => in_array($circleName, $circle->getName(), true));
|
||||
array_filter($circles, static fn ($circle) => \in_array($circleName, $circle->getName(), true));
|
||||
$circle = $circles[0];
|
||||
|
||||
$events = $this->em->getRepository(\Chill\EventBundle\Entity\Event::class)
|
||||
@@ -469,7 +465,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
* Return a random event only if he has more than one participation.
|
||||
*
|
||||
* @param string $centerName
|
||||
* @param type $circleName
|
||||
* @param type $circleName
|
||||
*
|
||||
* @return \Chill\EventBundle\Entity\Event
|
||||
*/
|
||||
@@ -507,7 +503,7 @@ final class ParticipationControllerTest extends WebTestCase
|
||||
|
||||
$person = $persons[array_rand($persons)];
|
||||
|
||||
if (in_array($person->getId(), $this->personsIdsCache, true)) {
|
||||
if (\in_array($person->getId(), $this->personsIdsCache, true)) {
|
||||
return $this->getRandomPerson($centerName); // we try another time
|
||||
}
|
||||
$this->personsIdsCache[] = $person->getId();
|
||||
|
Reference in New Issue
Block a user