mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-07 13:14:20 +01:00
Tests 3
This commit is contained in:
@@ -5,39 +5,17 @@ declare(strict_types=1);
|
||||
namespace Tvdt\Tests\Repository;
|
||||
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Tvdt\Entity\Candidate;
|
||||
use Tvdt\Entity\Quiz;
|
||||
use Tvdt\Entity\QuizCandidate;
|
||||
use Tvdt\Entity\Season;
|
||||
use Tvdt\Repository\CandidateRepository;
|
||||
use Tvdt\Repository\QuizCandidateRepository;
|
||||
use Tvdt\Repository\SeasonRepository;
|
||||
|
||||
#[CoversClass(QuizCandidateRepository::class)]
|
||||
final class QuizCandidateRepositoryTest extends KernelTestCase
|
||||
final class QuizCandidateRepositoryTest extends DatabaseTestCase
|
||||
{
|
||||
private SeasonRepository $seasonRepository;
|
||||
|
||||
private QuizCandidateRepository $quizCandidateRepository;
|
||||
|
||||
private CandidateRepository $candidateRepository;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$container = self::getContainer();
|
||||
|
||||
$this->seasonRepository = $container->get(SeasonRepository::class);
|
||||
$this->quizCandidateRepository = $container->get(QuizCandidateRepository::class);
|
||||
$this->candidateRepository = $container->get(CandidateRepository::class);
|
||||
}
|
||||
|
||||
public function testCreateIfNotExists(): void
|
||||
{
|
||||
$krtekSeason = $this->seasonRepository->findOneBySeasonCode('krtek');
|
||||
$this->assertInstanceOf(Season::class, $krtekSeason);
|
||||
$candidate = $this->candidateRepository->findOneBy(['season' => $krtekSeason, 'name' => 'Myrthe']);
|
||||
$this->assertInstanceOf(Candidate::class, $candidate);
|
||||
$krtekSeason = $this->getSeasonByCode('krtek');
|
||||
$candidate = $this->getCandidateBySeasonAndName($krtekSeason, 'Myrthe');
|
||||
$quiz = $krtekSeason->activeQuiz;
|
||||
$this->assertInstanceOf(Quiz::class, $quiz);
|
||||
|
||||
@@ -57,10 +35,8 @@ final class QuizCandidateRepositoryTest extends KernelTestCase
|
||||
|
||||
public function testSetCorrectionsForCandidateUpdatesCandidateCorrectly(): void
|
||||
{
|
||||
$krtekSeason = $this->seasonRepository->findOneBySeasonCode('krtek');
|
||||
$this->assertInstanceOf(Season::class, $krtekSeason);
|
||||
$candidate = $this->candidateRepository->findOneBy(['season' => $krtekSeason, 'name' => 'Myrthe']);
|
||||
$this->assertInstanceOf(Candidate::class, $candidate);
|
||||
$krtekSeason = $this->getSeasonByCode('krtek');
|
||||
$candidate = $this->getCandidateBySeasonAndName($krtekSeason, 'Myrthe');
|
||||
$quiz = $krtekSeason->activeQuiz;
|
||||
$this->assertInstanceOf(Quiz::class, $quiz);
|
||||
|
||||
@@ -82,10 +58,8 @@ final class QuizCandidateRepositoryTest extends KernelTestCase
|
||||
|
||||
public function testCannotGiveCorrectionsToCandidateWithoutResult(): void
|
||||
{
|
||||
$krtekSeason = $this->seasonRepository->findOneBySeasonCode('krtek');
|
||||
$this->assertInstanceOf(Season::class, $krtekSeason);
|
||||
$candidate = $this->candidateRepository->findOneBy(['season' => $krtekSeason, 'name' => 'Myrthe']);
|
||||
$this->assertInstanceOf(Candidate::class, $candidate);
|
||||
$krtekSeason = $this->getSeasonByCode('krtek');
|
||||
$candidate = $this->getCandidateBySeasonAndName($krtekSeason, 'Myrthe');
|
||||
$quiz = $krtekSeason->activeQuiz;
|
||||
$this->assertInstanceOf(Quiz::class, $quiz);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user