예제 #1
0
 public function testPartialCreate()
 {
     $title = 'Error Title';
     $status = '422';
     $code = 'illogical';
     $error = Error::create([Error::TITLE => $title, Error::STATUS => $status, Error::CODE => $code]);
     $this->assertEquals($title, $error->getTitle(), 'Invalid title');
     $this->assertEquals($status, $error->getStatus(), 'Invalid status');
     $this->assertEquals($code, $error->getCode(), 'Invalid code');
 }
예제 #2
0
 /**
  * @param $key
  * @param array $values
  * @return Error
  */
 protected function make($key, array $values)
 {
     $error = Error::create($this->get($key));
     if ($this->replacer && $error->hasDetail()) {
         $detail = $this->replacer->replace($error->getDetail(), $values);
         $error->setDetail($detail);
     }
     return $error;
 }