feat: all-season assignments
This commit is contained in:
1 parent
675cec1b69
commit
cf876ed224
119 files changed
+6194
-294
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Repository;
|
||||
|
||||
use App\Entity\Upload;
|
||||
use App\Repository\UploadRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
/**
|
||||
* The document picker decides which files an administrative setting may point at, so the type
|
||||
* restriction is pinned here: unrestricted it offers every upload in the system, which would let
|
||||
* a setting reference a teamer's Honorarvertrag or Beleg.
|
||||
*/
|
||||
class UploadRepositoryTest extends KernelTestCase
|
||||
{
|
||||
public function testTheAutocompleteOnlyOffersTheGlobalLibrary(): void
|
||||
{
|
||||
$qb = $this->createAutocompletionQueryBuilder();
|
||||
|
||||
$this->assertStringContainsString('upload.type = :type', $qb->getDQL());
|
||||
$this->assertSame(
|
||||
Upload::TYPE_DOCUMENT,
|
||||
$qb->getQuery()->getParameter('type')->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
public function testTheAutocompleteStillSearchesBothNames(): void
|
||||
{
|
||||
$dql = $this->createAutocompletionQueryBuilder()->getDQL();
|
||||
|
||||
$this->assertStringContainsString('upload.originalFilename LIKE :filename', $dql);
|
||||
$this->assertStringContainsString('upload.displayName LIKE :filename', $dql);
|
||||
}
|
||||
|
||||
private function createAutocompletionQueryBuilder(): QueryBuilder
|
||||
{
|
||||
/** @var EntityManagerInterface $entityManager */
|
||||
$entityManager = static::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
/** @var UploadRepository $repository */
|
||||
$repository = $entityManager->getRepository(Upload::class);
|
||||
|
||||
$reflection = new \ReflectionMethod($repository, 'createAutocompletionQueryBuilder');
|
||||
|
||||
return $reflection->invoke($repository, '');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user