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(); } }