mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-06 21:39:42 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -15,14 +15,13 @@ use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Tests\TestHelper as MainTestHelper;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\ReportBundle\Entity\Report;
|
||||
use DateTime;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* Test a report is shown into timeline.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class TimelineProviderTest extends WebTestCase
|
||||
@@ -49,7 +48,7 @@ final class TimelineProviderTest extends WebTestCase
|
||||
$center = self::$em->getRepository(\Chill\MainBundle\Entity\Center::class)
|
||||
->findOneBy(['name' => 'Center A']);
|
||||
|
||||
$person = (new Person(new DateTime('2015-05-01')))
|
||||
$person = (new Person(new \DateTime('2015-05-01')))
|
||||
->setGender(Person::FEMALE_GENDER)
|
||||
->setFirstName('Nelson')
|
||||
->setLastName('Mandela')
|
||||
@@ -61,13 +60,13 @@ final class TimelineProviderTest extends WebTestCase
|
||||
self::$em
|
||||
->getRepository(\Chill\MainBundle\Entity\Scope::class)
|
||||
->findAll(),
|
||||
static fn (Scope $scope) => $scope->getName()['en'] === 'social'
|
||||
static fn (Scope $scope) => 'social' === $scope->getName()['en']
|
||||
);
|
||||
|
||||
$report = (new Report())
|
||||
->setUser(self::$em->getRepository(\Chill\MainBundle\Entity\User::class)
|
||||
->findOneByUsername('center a_social'))
|
||||
->setDate(new DateTime('2015-05-02'))
|
||||
->setDate(new \DateTime('2015-05-02'))
|
||||
->setPerson($this->person)
|
||||
->setCFGroup($this->getHousingCustomFieldsGroup())
|
||||
->setCFData(['has_logement' => 'own_house',
|
||||
@@ -82,10 +81,10 @@ final class TimelineProviderTest extends WebTestCase
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
//static::$em->refresh($this->person);
|
||||
//static::$em->refresh($this->report);
|
||||
// static::$em->refresh($this->person);
|
||||
// static::$em->refresh($this->report);
|
||||
// static::$em->remove($this->person);
|
||||
//static::$em->remove($this->report);
|
||||
// static::$em->remove($this->report);
|
||||
}
|
||||
|
||||
public function testReportIsNotVisibleToUngrantedUsers()
|
||||
@@ -95,8 +94,8 @@ final class TimelineProviderTest extends WebTestCase
|
||||
MainTestHelper::getAuthenticatedClientOptions('center a_administrative')
|
||||
);
|
||||
|
||||
$crawler = $client->request('GET', '/fr/person/' . $this->person->getId()
|
||||
. '/timeline');
|
||||
$crawler = $client->request('GET', '/fr/person/'.$this->person->getId()
|
||||
.'/timeline');
|
||||
|
||||
$this->assertEquals(
|
||||
0,
|
||||
@@ -116,8 +115,8 @@ final class TimelineProviderTest extends WebTestCase
|
||||
MainTestHelper::getAuthenticatedClientOptions()
|
||||
);
|
||||
|
||||
$crawler = $client->request('GET', '/fr/person/' . $this->person->getId()
|
||||
. '/timeline');
|
||||
$crawler = $client->request('GET', '/fr/person/'.$this->person->getId()
|
||||
.'/timeline');
|
||||
|
||||
$this->assertTrue(
|
||||
$client->getResponse()->isSuccessful(),
|
||||
@@ -132,16 +131,16 @@ final class TimelineProviderTest extends WebTestCase
|
||||
|
||||
public function testTimelineReportWithSummaryField()
|
||||
{
|
||||
//load the page
|
||||
// load the page
|
||||
$client = self::createClient(
|
||||
[],
|
||||
MainTestHelper::getAuthenticatedClientOptions()
|
||||
);
|
||||
|
||||
$crawler = $client->request('GET', '/fr/person/' . $this->person->getId()
|
||||
. '/timeline');
|
||||
$crawler = $client->request('GET', '/fr/person/'.$this->person->getId()
|
||||
.'/timeline');
|
||||
|
||||
//performs tests
|
||||
// performs tests
|
||||
$this->assertTrue(
|
||||
$client->getResponse()->isSuccessful(),
|
||||
'The page timeline is loaded successfully'
|
||||
@@ -168,11 +167,11 @@ final class TimelineProviderTest extends WebTestCase
|
||||
->findAll();
|
||||
|
||||
foreach ($groups as $group) {
|
||||
if ($group->getName()['fr'] === 'Situation de logement') {
|
||||
if ('Situation de logement' === $group->getName()['fr']) {
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
|
||||
return $groups[random_int(0, count($groups) - 1)];
|
||||
return $groups[random_int(0, \count($groups) - 1)];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user