apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -16,17 +16,13 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Test\PrepareClientTrait;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Iterator;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use function array_pop;
use function count;
use function preg_match;
/**
* @internal
*
* @coversNothing
*/
final class AccompanyingCourseControllerTest extends WebTestCase
@@ -45,28 +41,28 @@ final class AccompanyingCourseControllerTest extends WebTestCase
self::ensureKernelShutdown();
}
public function dataGenerateRandomUsers(): Iterator
public function dataGenerateRandomUsers(): \Iterator
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$period = new AccompanyingPeriod(new DateTime('1 week ago'));
$period = new AccompanyingPeriod(new \DateTime('1 week ago'));
$user = $em->getRepository(User::class)
->findOneByUsernameCanonical('center a_social');
$period->setCreatedBy($user);
//$period->setCreatedAt(new \DateTime('yesterday'));
// $period->setCreatedAt(new \DateTime('yesterday'));
$center = $em->getRepository(Center::class)
->findOneBy(['name' => 'Center A']);
$personIds = $em->createQuery('SELECT p.id FROM ' .
Person::class . ' p JOIN p.centerCurrent cc ' .
$personIds = $em->createQuery('SELECT p.id FROM '.
Person::class.' p JOIN p.centerCurrent cc '.
' WHERE cc.center = :center')
->setParameter('center', $center)
->setMaxResults(100)
->getScalarResult();
yield [array_pop($personIds), array_pop($personIds)];
yield [\array_pop($personIds), \array_pop($personIds)];
self::ensureKernelShutdown();
}
@@ -78,7 +74,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase
$this->assertResponseRedirects();
$location = $this->client->getResponse()->headers->get('Location');
$this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location));
$this->assertEquals(1, \preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location));
}
/**
@@ -97,7 +93,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase
$location = $this->client->getResponse()->headers->get('Location');
$matches = [];
$this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location, $matches));
$this->assertEquals(1, \preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location, $matches));
$id = $matches[1];
$period = self::$container->get(EntityManagerInterface::class)
@@ -106,6 +102,6 @@ final class AccompanyingCourseControllerTest extends WebTestCase
$this->assertNotNull($period);
$this->assertEquals(2, count($period->getParticipations()));
$this->assertEquals(2, \count($period->getParticipations()));
}
}