mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-01 12:33:49 +00:00
Fix calendarControllerTest: fix acl, and add calendar acl on fixtures
This commit is contained in:
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\CalendarBundle\Tests\Controller;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -42,14 +43,32 @@ final class CalendarControllerTest extends WebTestCase
|
||||
|
||||
$nb = $em->createQueryBuilder()
|
||||
->from(AccompanyingPeriod::class, 'ac')
|
||||
->select('COUNT(ac) AS nb')
|
||||
->join('ac.participations', 'acp')
|
||||
->join('acp.person', 'person')
|
||||
->join('person.centerCurrent', 'pc')
|
||||
->join('pc.center', 'center')
|
||||
->where('center.name LIKE :n')
|
||||
->setParameter('n', 'Center A')
|
||||
->join('ac.scopes', 's')
|
||||
->andWhere('JSON_EXTRACT(s.name,\'fr\') LIKE :s')
|
||||
->setParameter('s', 'social')
|
||||
->select('COUNT(DISTINCT ac) AS nb')
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
|
||||
yield [$em->createQueryBuilder()
|
||||
->from(AccompanyingPeriod::class, 'ac')
|
||||
->select('ac.id')
|
||||
->setFirstResult(random_int(0, $nb))
|
||||
->join('ac.participations', 'acp')
|
||||
->join('acp.person', 'person')
|
||||
->join('person.centerCurrent', 'pc')
|
||||
->join('pc.center', 'center')
|
||||
->where('center.name LIKE :n')
|
||||
->setParameter('n', 'Center A')
|
||||
->join('ac.scopes', 's')
|
||||
->andWhere('JSON_EXTRACT(s.name,\'fr\') LIKE :s')
|
||||
->setParameter('s', 'social')
|
||||
->setFirstResult(random_int(0, $nb - 1))
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getSingleScalarResult(),
|
||||
@@ -63,7 +82,7 @@ final class CalendarControllerTest extends WebTestCase
|
||||
{
|
||||
$this->client->request(
|
||||
Request::METHOD_GET,
|
||||
sprintf('/fr/calendar/calendar/?accompanying_period_id=%d', $accompanyingPeriodId)
|
||||
sprintf('/fr/calendar/calendar/by-period/%d', $accompanyingPeriodId)
|
||||
);
|
||||
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
|
Reference in New Issue
Block a user