mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 08:03:49 +00:00
Ticket: ajout de paramètres à la requête de liste de tickets
This commit is contained in:
@@ -12,6 +12,8 @@ declare(strict_types=1);
|
||||
namespace Chill\TicketBundle\Tests\Repository;
|
||||
|
||||
use Chill\PersonBundle\DataFixtures\Helper\RandomPersonHelperTrait;
|
||||
use Chill\TicketBundle\Entity\EmergencyStatusEnum;
|
||||
use Chill\TicketBundle\Entity\Motive;
|
||||
use Chill\TicketBundle\Entity\StateEnum;
|
||||
use Chill\TicketBundle\Repository\TicketACLAwareRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -74,8 +76,51 @@ class TicketACLAwareRepositoryTest extends KernelTestCase
|
||||
|
||||
public function testFindTicketByCurrentStateMultipleState(): void
|
||||
{
|
||||
$result = $this->repository->countTickets(['byCurrentState' => [StateEnum::OPEN, StateEnum::CLOSED]]);
|
||||
$result = $this->repository->findTickets(['byCurrentState' => [StateEnum::OPEN, StateEnum::CLOSED]]);
|
||||
|
||||
self::assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCountTicketByCurrentStateEmergencySingleState(): void
|
||||
{
|
||||
$result = $this->repository->countTickets(['byCurrentStateEmergency' => [EmergencyStatusEnum::YES]]);
|
||||
|
||||
self::assertIsInt($result);
|
||||
}
|
||||
|
||||
public function testFindTicketByCurrentStateEmergencyMultipleState(): void
|
||||
{
|
||||
$result = $this->repository->findTickets(['byCurrentStateEmergency' => [EmergencyStatusEnum::YES, EmergencyStatusEnum::NO]]);
|
||||
|
||||
self::assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testFindTicketByMotives(): void
|
||||
{
|
||||
$motives = $this->entityManager->createQuery(sprintf('SELECT m FROM %s m', Motive::class))
|
||||
->setMaxResults(2)
|
||||
->getResult();
|
||||
|
||||
if ([] === $motives) {
|
||||
throw new \UnexpectedValueException('No motives found');
|
||||
}
|
||||
|
||||
$results = $this->repository->findTickets(['byMotives' => $motives]);
|
||||
|
||||
self::assertIsArray($results);
|
||||
}
|
||||
|
||||
public function testFindTicketByCreatedBefore(): void
|
||||
{
|
||||
$actual = $this->repository->findTickets(['byCreatedBefore' => (new \DateTimeImmutable('now'))->add(new \DateInterval('P1D'))]);
|
||||
|
||||
self::assertIsArray($actual);
|
||||
}
|
||||
|
||||
public function testFindTicketByCreatedAfter(): void
|
||||
{
|
||||
$actual = $this->repository->findTickets(['byCreatedAfter' => (new \DateTimeImmutable('now'))->sub(new \DateInterval('P1M'))]);
|
||||
|
||||
self::assertIsArray($actual);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user