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