domainService = $this->prophesize(DomainServiceInterface::class); $this->action = new ListDomainsAction($this->domainService->reveal(), 'foo.com'); } /** @test */ public function domainsAreProperlyListed(): void { $domains = [ new DomainItem('bar.com', true), new DomainItem('baz.com', false), ]; $listDomains = $this->domainService->listDomains()->willReturn($domains); /** @var JsonResponse $resp */ $resp = $this->action->handle(ServerRequestFactory::fromGlobals()); $payload = $resp->getPayload(); self::assertEquals([ 'domains' => [ 'data' => $domains, ], ], $payload); $listDomains->shouldHaveBeenCalledOnce(); } }