Exemplo n.º 1
0
 /**
  * @param ErrorCollection $errors
  * @param $pointer
  * @param $errorKey
  * @param $status
  */
 protected function assertErrorAt(ErrorCollection $errors, $pointer, $errorKey, $status = null)
 {
     $error = $this->findErrorAt($errors, $pointer);
     $expected = $this->errorRepository->error($errorKey);
     if ($status) {
         $expected->setStatus($status);
     }
     $this->assertEquals($expected->getTitle(), $error->getTitle(), 'Unexpected error title.');
     $this->assertEquals($expected->getStatus(), $error->getStatus(), 'Unexpected error status.');
 }
 /**
  * @param $key
  * @param $id
  * @param $detail
  * @return $this
  */
 private function willSee($key, $id, $detail = null)
 {
     $this->repository->configure([$key => [MutableErrorInterface::ID => $id, MutableErrorInterface::DETAIL => $detail]]);
     return $this;
 }
 /**
  * Bind the error repository into the service container.
  */
 protected function bindErrorRepository()
 {
     $this->app->singleton(ReplacerInterface::class, Replacer::class);
     $this->app->singleton(['json-api.errors' => ErrorRepositoryInterface::class], function () {
         /** @var ReplacerInterface $replacer */
         $replacer = $this->app->make(ReplacerInterface::class);
         $repository = new ErrorRepository($replacer);
         $repository->configure($this->getErrorConfig());
         return $repository;
     });
 }