mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-11 20:38:21 +02:00
test: expand coverage, dedupe data-driven tests, extract shared WebTestCase base
- Add #[CoversClass] to Base64Test and FilenameSanitizerTest - Merge near-duplicate test methods into #[DataProvider] cases across ResetPasswordControllerTest, SettingsControllerTest, ClaimSeasonCommandTest, FilenameSanitizerTest, Base64Test, and SeasonRepositoryTest - Add integration tests for previously untested controllers: public QuizController (quiz-taking flow), LoginController, RegistrationController, EliminationController, and PrepareEliminationController - Add unit tests for Elimination and BankQuestion entity logic - Extract shared WebTestCase setup/helpers (client, entityManager, login, entity lookups, CSRF token scraping) into AbstractControllerWebTestCase, removing duplicated boilerplate from all 14 WebTestCase files
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Tvdt\Tests\Command;
|
||||
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
@@ -48,21 +49,19 @@ final class ClaimSeasonCommandTest extends KernelTestCase
|
||||
$this->assertCount(3, $season->owners);
|
||||
}
|
||||
|
||||
public function testInvalidEmailFails(): void
|
||||
/** @return iterable<string, array{string, string}> */
|
||||
public static function invalidArgumentsProvider(): iterable
|
||||
{
|
||||
$this->commandTester->execute([
|
||||
'season-code' => 'krtek',
|
||||
'email' => 'nonexisting@example.org',
|
||||
]);
|
||||
|
||||
$this->assertSame(Command::FAILURE, $this->commandTester->getStatusCode());
|
||||
yield 'unknown email' => ['krtek', 'nonexisting@example.org'];
|
||||
yield 'unknown season' => ['dhadk', 'test@example.org'];
|
||||
}
|
||||
|
||||
public function testInvalidSeasonCodeFails(): void
|
||||
#[DataProvider('invalidArgumentsProvider')]
|
||||
public function testInvalidArgumentFails(string $seasonCode, string $email): void
|
||||
{
|
||||
$this->commandTester->execute([
|
||||
'season-code' => 'dhadk',
|
||||
'email' => 'test@example.org',
|
||||
'season-code' => $seasonCode,
|
||||
'email' => $email,
|
||||
]);
|
||||
|
||||
$this->assertSame(Command::FAILURE, $this->commandTester->getStatusCode());
|
||||
|
||||
Reference in New Issue
Block a user