diff --git a/module/CLI/test/Command/Domain/ListDomainsCommandTest.php b/module/CLI/test/Command/Domain/ListDomainsCommandTest.php new file mode 100644 index 00000000..ded8572f --- /dev/null +++ b/module/CLI/test/Command/Domain/ListDomainsCommandTest.php @@ -0,0 +1,56 @@ +domainService = $this->prophesize(DomainServiceInterface::class); + + $command = new ListDomainsCommand($this->domainService->reveal(), 'foo.com'); + $app = new Application(); + $app->add($command); + + $this->commandTester = new CommandTester($command); + } + + /** @test */ + public function allDomainsAreProperlyPrinted(): void + { + $expectedOutput = <<domainService->listDomainsWithout('foo.com')->willReturn([ + new Domain('bar.com'), + new Domain('baz.com'), + ]); + + $this->commandTester->execute([]); + + self::assertEquals($expectedOutput, $this->commandTester->getDisplay()); + self::assertEquals(ExitCodes::EXIT_SUCCESS, $this->commandTester->getStatusCode()); + $listDomains->shouldHaveBeenCalledOnce(); + } +}