apiKeyService = $this->createMock(ApiKeyServiceInterface::class); $this->commandTester = $this->testerForCommand(new InitialApiKeyCommand($this->apiKeyService)); } #[Test, DataProvider('provideParams')] public function initialKeyIsCreatedWithProvidedValue(?ApiKey $result, bool $verbose, string $expectedOutput): void { $this->apiKeyService->expects($this->once())->method('createInitial')->with('the_key')->willReturn($result); $this->commandTester->execute( ['apiKey' => 'the_key'], ['verbosity' => $verbose ? OutputInterface::VERBOSITY_VERBOSE : OutputInterface::VERBOSITY_NORMAL], ); $output = $this->commandTester->getDisplay(); self::assertEquals($expectedOutput, $output); } public static function provideParams(): iterable { yield 'api key created, no verbose' => [ApiKey::create(), false, '']; yield 'api key created, verbose' => [ApiKey::create(), true, '']; yield 'no api key created, no verbose' => [null, false, '']; yield 'no api key created, verbose' => [null, true, <<