domainService = $this->prophesize(DomainServiceInterface::class); $command = new ListDomainsCommand($this->domainService->reveal()); $app = new Application(); $app->add($command); $this->commandTester = new CommandTester($command); } /** @test */ public function allDomainsAreProperlyPrinted(): void { $expectedOutput = <<domainService->listDomains()->willReturn([ new DomainItem('foo.com', true), new DomainItem('bar.com', false), new DomainItem('baz.com', false), ]); $this->commandTester->execute([]); self::assertEquals($expectedOutput, $this->commandTester->getDisplay()); self::assertEquals(ExitCodes::EXIT_SUCCESS, $this->commandTester->getStatusCode()); $listDomains->shouldHaveBeenCalledOnce(); } }