domainService = $this->prophesize(DomainServiceInterface::class); $this->commandTester = $this->testerForCommand(new ListDomainsCommand($this->domainService->reveal())); } /** @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(); } }