assertInstanceOf(KernelInterface::class, self::$kernel); $this->seasonRepository = $container->get(SeasonRepository::class); $application = new Application(self::$kernel); $command = $application->find('tvdt:claim-season'); $this->commandTester = new CommandTester($command); } public function testSeasonClaim(): void { $this->commandTester->execute([ 'season-code' => 'krtek', 'email' => 'test@example.org', ]); $season = $this->seasonRepository->findOneBySeasonCode('krtek'); $this->assertInstanceOf(Season::class, $season); $this->assertSame(Command::SUCCESS, $this->commandTester->getStatusCode()); $this->assertCount(3, $season->owners); } /** @return iterable */ public static function invalidArgumentsProvider(): iterable { yield 'unknown email' => ['krtek', 'nonexisting@example.org']; yield 'unknown season' => ['dhadk', 'test@example.org']; } #[DataProvider('invalidArgumentsProvider')] public function testInvalidArgumentFails(string $seasonCode, string $email): void { $this->commandTester->execute([ 'season-code' => $seasonCode, 'email' => $email, ]); $this->assertSame(Command::FAILURE, $this->commandTester->getStatusCode()); } }