public function it_can_handle_errors_when_executing_a_request(RequestInterface $request) { $tokenUuid = Uuid::uuid4()->toString(); $passCode = bin2hex(random_bytes(20)); $request->getAcceptContentType()->willReturn('*/*'); $request->offsetGet('token')->willReturn($tokenUuid); $request->offsetGet('pass_code')->willReturn($passCode); $this->tokenService->getToken(Uuid::fromString($tokenUuid), $passCode)->willThrow(new \RuntimeException()); $this->shouldThrow(ResponseException::class)->duringExecuteRequest($request); }
public function it_can_handle_exception_during_request(RequestInterface $request, UploadedFileInterface $file) { $path = '/path/To/a'; $file->getClientFilename()->willReturn($name = 'file.ext'); $file->getClientMediaType()->willReturn($mime = 'text/xml'); $file->getStream()->willReturn($stream = tmpfile()); $files = [$file]; $request->offsetGet('path')->willReturn($path); $request->offsetGet('files')->willReturn($files); $request->getAcceptContentType()->willReturn('application/json'); $this->fileRepository->fromInput($name, $path, $mime, $stream)->willThrow(new \RuntimeException()); $this->shouldThrow(ResponseException::class)->duringExecuteRequest($request); }
public function it_will_error_on_error_during_request_execution(RequestInterface $request) { $fullPath = '/path/to/file.ext'; $request->offsetGet('path')->willReturn($fullPath); $request->getAcceptContentType()->willReturn('*/*'); $this->imageRepository->getByFullPath($fullPath)->willThrow(new \RuntimeException()); $this->shouldThrow(ResponseException::class)->duringExecuteRequest($request); }
public function it_can_handle_exception_during_request(RequestInterface $request) { $uuid = Uuid::uuid4(); $request->offsetGet('uuid')->willReturn($uuid->toString()); $request->getAcceptContentType()->willReturn('text/xml'); $this->pageRepository->getByUuid($uuid)->willThrow(new \RuntimeException()); $this->shouldThrow(ResponseException::class)->duringExecuteRequest($request); }
public function it_can_handle_exception_during_request(RequestInterface $request) { $path = '/path/to/'; $request->offsetGet('path')->willReturn($path); $request->getAcceptContentType()->willReturn('*/*'); $this->fileRepository->getDirectoriesInPath($path)->willThrow(new \RuntimeException()); $this->shouldThrow(ResponseException::class)->duringExecuteRequest($request); }
public function it_will_throw_ResponseException_on_errors(RequestInterface $request) { $request->offsetGet('title')->willThrow(new \OutOfBoundsException()); $request->getAcceptContentType()->willReturn('application/json'); $this->shouldThrow(ResponseException::class)->duringExecuteRequest($request); }
public function it_can_handle_errors_when_executing_a_request(RequestInterface $request) { $emailAddress = '*****@*****.**'; $password = '******'; $request->getAcceptContentType()->willReturn('*/*'); $request->offsetGet('email_address')->willReturn($emailAddress); $request->offsetGet('password')->willReturn($password); $this->authenticationService->login($emailAddress, $password)->willThrow(new \RuntimeException()); $this->shouldThrow(ResponseException::class)->duringExecuteRequest($request); }