public function let(ValidationResult $result, RequestInterface $request) { $this->result = $result; $this->request = $request; $this->beConstructedWith($result, $request); $this->request->getAcceptContentType()->willReturn('*/*'); $this->messages = ['field' => ['Error::EXAMPLE' => 'This is an example message']]; $this->result->getMessages()->willReturn($this->messages); }
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_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_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_invalidate_a_block(PageBlock $block, RequestInterface $request) { $request->getAcceptContentType()->willReturn('*/*'); $block->getParameters()->willReturn(['youtubeUrl' => 'https://vimeo.com/s0m3Ur1']); $this->shouldThrow(ValidationFailedException::class)->duringValidate($block, $request); }
public function __construct(array $attributes, RequestInterface $request) { $this->attributes = $attributes; $this->contentType = $request->getAcceptContentType(); }
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); }
public function it_can_invalidate_a_block(PageBlock $block, RequestInterface $request) { $request->getAcceptContentType()->willReturn('*/*'); $block->getParameters()->willReturn(['feedUrl' => 'not-a-url']); $this->shouldThrow(ValidationFailedException::class)->duringValidate($block, $request); }
public function __construct(string $name, array $data, RequestInterface $request) { $this->name = $name; $this->attributes = $data; $this->contentType = $request->getAcceptContentType(); }