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