public function testAddErrorWithParameter()
 {
     $expected = new Error('123');
     $expected->setDetail('Expecting to see bar as the value');
     $expected->setSourceParameter($param = 'foobar');
     $this->willSee('my-error', '123', 'Expecting to see {foo} as the value');
     $this->assertEquals($expected, $this->addErrorWithParameter('my-error', $param, ['foo' => 'bar']));
     $this->assertError($expected);
 }
 public function testDataAcceptableReturnsErrors()
 {
     $content = '{"data": {"type": "users", "id": "99"}}';
     $document = $this->decode($content);
     $validator = $this->hasOne(false, true, function () {
         $error = new Error();
         $error->setDetail('Foobar');
         return new MutableErrorCollection([$error]);
     });
     $this->assertFalse($validator->isValid($document));
     $this->assertDetailIs($validator->getErrors(), '/data', 'Foobar');
 }