Exemple #1
0
 public function it_can_handle_exception_during_request(RequestInterface $request)
 {
     $uuid = Uuid::uuid4();
     $request->offsetExists('parent_uuid')->willReturn(true);
     $request->offsetGet('parent_uuid')->willReturn($uuid->toString());
     $request->getAcceptContentType()->willReturn('text/xml');
     $this->pageRepository->getAllByParentUuid($uuid)->willThrow(new \RuntimeException());
     $this->shouldThrow(ResponseException::class)->duringExecuteRequest($request);
 }
Exemple #2
0
 public function executeRequest(RequestInterface $request) : ResponseInterface
 {
     try {
         $parentUuid = isset($request['parent_uuid']) ? Uuid::fromString($request['parent_uuid']) : null;
         return new Response(self::MESSAGE, ['data' => $this->pageRepository->getAllByParentUuid($parentUuid), 'parent_uuid' => $parentUuid, 'includes' => ['pageBlocks']], $request);
     } catch (\Throwable $e) {
         $this->log(LogLevel::ERROR, $e->getMessage());
         throw new ResponseException('An error occurred during ListPagesHandler.', new ServerErrorResponse([], $request));
     }
 }