mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-06 20:54: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:
@@ -8,9 +8,8 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\Argument;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Tvdt\Entity\Season;
|
||||
use Tvdt\Repository\SeasonRepository;
|
||||
use Tvdt\Repository\UserRepository;
|
||||
|
||||
@@ -18,7 +17,7 @@ use Tvdt\Repository\UserRepository;
|
||||
name: 'tvdt:claim-season',
|
||||
description: 'Give a user owner rights on a season',
|
||||
)]
|
||||
readonly class ClaimSeasonCommand
|
||||
final readonly class ClaimSeasonCommand
|
||||
{
|
||||
public function __construct(private UserRepository $userRepository, private SeasonRepository $seasonRepository, private EntityManagerInterface $entityManager) {}
|
||||
|
||||
@@ -27,14 +26,11 @@ readonly class ClaimSeasonCommand
|
||||
string $seasonCode,
|
||||
#[Argument]
|
||||
string $email,
|
||||
InputInterface $input,
|
||||
OutputInterface $output,
|
||||
SymfonyStyle $io,
|
||||
): int {
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
try {
|
||||
$season = $this->seasonRepository->findOneBy(['seasonCode' => $seasonCode]);
|
||||
if (null === $season) {
|
||||
$season = $this->seasonRepository->findOneBySeasonCode($seasonCode);
|
||||
if (!$season instanceof Season) {
|
||||
throw new \InvalidArgumentException('Season not found');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user