mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-06 12:44:20 +01:00
Create Testcoverage and upgrade Symfomy and PHP
* Some tests * More tests! * Tests 3 * Move getScores from Candidate to Quiz * Add some suggestions for future refactoring * - **Add Gedmo doctrine-extensions and Stof bundle integration** - Added `stof/doctrine-extensions-bundle` and `gedmo/doctrine-extensions` dependencies. - Integrated `Timestampable` behavior for `Created` fields in entities. - Updated `bundles.php` to register StofDoctrineExtensionsBundle. - Added configuration for the Stof bundle. - Simplified `SeasonVoter` with `match` expression and added new tests. - Minor fixes and adjustments across various files. * WIP * All the tests * Base64 tests * Symfomny 7.4.0 * Update * Update recipe * PHP 8.5 * Rector changes * More 8.5 * Things
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Tvdt\Entity;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Safe\DateTimeImmutable;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
use Symfony\Bridge\Doctrine\Types\UuidType;
|
||||
use Symfony\Component\HttpFoundation\InputBag;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
@@ -30,6 +30,7 @@ class Elimination
|
||||
#[ORM\Column(type: Types::JSONB)]
|
||||
public array $data = [];
|
||||
|
||||
#[Gedmo\Timestampable(on: 'create')]
|
||||
#[ORM\Column(type: Types::DATETIMETZ_IMMUTABLE, nullable: false)]
|
||||
public private(set) \DateTimeImmutable $created;
|
||||
|
||||
@@ -54,12 +55,10 @@ class Elimination
|
||||
|
||||
public function getScreenColour(?string $name): ?string
|
||||
{
|
||||
if (null === $name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->data[$name] ?? null;
|
||||
}
|
||||
|
||||
#[ORM\PrePersist]
|
||||
public function setCreatedAtValue(): void
|
||||
{
|
||||
$this->created = new DateTimeImmutable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,12 @@ namespace Tvdt\Entity;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Safe\DateTimeImmutable;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
use Symfony\Bridge\Doctrine\Types\UuidType;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
use Tvdt\Repository\GivenAnswerRepository;
|
||||
|
||||
#[ORM\Entity(repositoryClass: GivenAnswerRepository::class)]
|
||||
#[ORM\HasLifecycleCallbacks]
|
||||
class GivenAnswer
|
||||
{
|
||||
#[ORM\Column(type: UuidType::NAME, unique: true)]
|
||||
@@ -21,6 +20,7 @@ class GivenAnswer
|
||||
#[ORM\Id]
|
||||
public private(set) Uuid $id;
|
||||
|
||||
#[Gedmo\Timestampable(on: 'create')]
|
||||
#[ORM\Column(type: Types::DATETIMETZ_IMMUTABLE, nullable: false)]
|
||||
public private(set) \DateTimeImmutable $created;
|
||||
|
||||
@@ -37,10 +37,4 @@ class GivenAnswer
|
||||
#[ORM\ManyToOne(inversedBy: 'givenAnswers')]
|
||||
private(set) Answer $answer,
|
||||
) {}
|
||||
|
||||
#[ORM\PrePersist]
|
||||
public function setCreatedAtValue(): void
|
||||
{
|
||||
$this->created = new DateTimeImmutable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,12 @@ namespace Tvdt\Entity;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Safe\DateTimeImmutable;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
use Symfony\Bridge\Doctrine\Types\UuidType;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
use Tvdt\Repository\QuizCandidateRepository;
|
||||
|
||||
#[ORM\Entity(repositoryClass: QuizCandidateRepository::class)]
|
||||
#[ORM\HasLifecycleCallbacks]
|
||||
#[ORM\UniqueConstraint(columns: ['candidate_id', 'quiz_id'])]
|
||||
class QuizCandidate
|
||||
{
|
||||
@@ -25,6 +24,7 @@ class QuizCandidate
|
||||
#[ORM\Column]
|
||||
public float $corrections = 0;
|
||||
|
||||
#[Gedmo\Timestampable(on: 'create')]
|
||||
#[ORM\Column(type: Types::DATETIMETZ_IMMUTABLE)]
|
||||
public private(set) \DateTimeImmutable $created;
|
||||
|
||||
@@ -37,10 +37,4 @@ class QuizCandidate
|
||||
#[ORM\ManyToOne(inversedBy: 'quizData')]
|
||||
public Candidate $candidate,
|
||||
) {}
|
||||
|
||||
#[ORM\PrePersist]
|
||||
public function setCreatedAtValue(): void
|
||||
{
|
||||
$this->created = new DateTimeImmutable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class Season
|
||||
return $this->owners->contains($user);
|
||||
}
|
||||
|
||||
public function generateSeasonCode(): self
|
||||
public function generateSeasonCode(): void
|
||||
{
|
||||
$code = '';
|
||||
$len = mb_strlen(self::SEASON_CODE_CHARACTERS) - 1;
|
||||
@@ -108,7 +108,5 @@ class Season
|
||||
}
|
||||
|
||||
$this->seasonCode = $code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user