domainService = $this->prophesize(DomainServiceInterface::class); $this->options = new NotFoundRedirectOptions(); $this->action = new ListDomainsAction($this->domainService->reveal(), $this->options); } /** @test */ public function domainsAreProperlyListed(): void { $apiKey = ApiKey::create(); $domains = [ DomainItem::forDefaultDomain('bar.com', new NotFoundRedirectOptions()), DomainItem::forNonDefaultDomain(Domain::withAuthority('baz.com')), ]; $listDomains = $this->domainService->listDomains($apiKey)->willReturn($domains); /** @var JsonResponse $resp */ $resp = $this->action->handle(ServerRequestFactory::fromGlobals()->withAttribute(ApiKey::class, $apiKey)); $payload = $resp->getPayload(); self::assertEquals([ 'domains' => [ 'data' => $domains, 'defaultRedirects' => NotFoundRedirects::fromConfig($this->options), ], ], $payload); $listDomains->shouldHaveBeenCalledOnce(); } }