/** * @test */ public function it_lists_available_shipping_locations() { $locations = $this->bookingService->listShippingLocations(); $this->assertEquals(2, count($locations)); $this->assertInstanceOf(LocationDto::class, $locations[0]); $this->assertEquals('DEHAM', $locations[0]->getUnLocode()); $this->assertEquals('Hamburg', $locations[0]->getName()); }
/** * @param RequestInterface $request * @param ResponseInterface $response * @return JsonResponse */ public function __invoke(RequestInterface $request, ResponseInterface $response) { return new JsonResponse(['locations' => array_map(function (LocationDto $locationDto) { return ['name' => $locationDto->getName(), 'unLocode' => $locationDto->getUnLocode()]; }, $this->bookingService->listShippingLocations())]); }