chill-bundles/src/Bundle/ChillTicketBundle/tests/Repository/TicketACLAwareRepositoryTest.php

67 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\TicketBundle\Tests\Repository;
use Chill\PersonBundle\DataFixtures\Helper\RandomPersonHelperTrait;
use Chill\TicketBundle\Repository\TicketACLAwareRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
/**
* @internal
*
* @coversNothing
*/
class TicketACLAwareRepositoryTest extends KernelTestCase
{
use RandomPersonHelperTrait;
private TicketACLAwareRepository $repository;
private EntityManagerInterface $entityManager;
protected function setUp(): void
{
self::bootKernel();
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
$this->repository = new TicketACLAwareRepository($this->entityManager);
}
public function testFindNoParameters(): void
{
// Test the findTickets method with byPerson parameter
$actual = $this->repository->findTickets([]);
// Only verify that the query executes successfully without checking results
self::assertIsList($actual);
}
public function testFindTicketByPerson(): void
{
$person = $this->getRandomPerson($this->entityManager);
// Test the findTickets method with byPerson parameter
$actual = $this->repository->findTickets(['byPerson' => [$person]]);
// Only verify that the query executes successfully without checking results
self::assertIsList($actual);
}
public function testCountTicketsByPerson(): void
{
$person = $this->getRandomPerson($this->entityManager);
$result = $this->repository->countTickets(['byPerson' => [$person]]);
self::assertIsInt($result);
}
}