mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-05 23:20:18 +02:00
feat: add question bank management, quiz finalization, and related backend/frontend functionality
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tvdt\Tests\Repository;
|
||||
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tvdt\Entity\QuestionLabel;
|
||||
use Tvdt\Repository\BankQuestionRepository;
|
||||
|
||||
#[CoversClass(BankQuestionRepository::class)]
|
||||
final class BankQuestionRepositoryTest extends DatabaseTestCase
|
||||
{
|
||||
private BankQuestionRepository $bankQuestionRepository;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->bankQuestionRepository = self::getContainer()->get(BankQuestionRepository::class);
|
||||
}
|
||||
|
||||
public function testFindBySeasonReturnsAllQuestions(): void
|
||||
{
|
||||
$season = $this->getSeasonByCode('krtek');
|
||||
|
||||
$bankQuestions = $this->bankQuestionRepository->findBySeason($season);
|
||||
|
||||
$this->assertCount(3, $bankQuestions);
|
||||
}
|
||||
|
||||
public function testFindBySeasonFiltersByLabel(): void
|
||||
{
|
||||
$season = $this->getSeasonByCode('krtek');
|
||||
$label = $this->entityManager->getRepository(QuestionLabel::class)
|
||||
->findOneBy(['season' => $season, 'name' => 'Locatie']);
|
||||
$this->assertInstanceOf(QuestionLabel::class, $label);
|
||||
|
||||
$bankQuestions = $this->bankQuestionRepository->findBySeason($season, $label);
|
||||
|
||||
$this->assertCount(2, $bankQuestions);
|
||||
foreach ($bankQuestions as $bankQuestion) {
|
||||
$this->assertTrue($bankQuestion->labels->contains($label));
|
||||
}
|
||||
}
|
||||
|
||||
public function testFindBySeasonIgnoresOtherSeasons(): void
|
||||
{
|
||||
$season = $this->getSeasonByCode('bbbbb');
|
||||
|
||||
$this->assertCount(0, $this->bankQuestionRepository->findBySeason($season));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user