. */ namespace App\Tests\Repository; use App\Entity\Parts\Category; use App\Repository\AttachmentContainingDBElementRepository; use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class AttachmentContainingDBElementRepositoryTest extends KernelTestCase { private EntityManagerInterface $entityManager; protected function setUp(): void { $kernel = self::bootKernel(); $this->entityManager = $kernel->getContainer() ->get('doctrine')->getManager(); } public function testGetElementsAndPreviewAttachmentByIDs(): void { $repo = $this->entityManager->getRepository(Category::class); $elements = $repo->getElementsAndPreviewAttachmentByIDs([2, 1, 5, 3]); //Elements are ordered the same way as the ID array $this->assertCount(4, $elements); $this->assertSame(2, $elements[0]->getId()); $this->assertSame(1, $elements[1]->getId()); $this->assertSame(5, $elements[2]->getId()); $this->assertSame(3, $elements[3]->getId()); } }