1
0
mirror of https://github.com/flarum/core.git synced 2025-07-31 13:40:20 +02:00

Restore error details in JSON-API error formatter

Fixes #1865. Refs #1843.
This commit is contained in:
Franz Liedke
2019-09-04 01:44:22 +02:00
parent a7b19284b9
commit 429b8e1a32
2 changed files with 41 additions and 6 deletions

View File

@@ -58,6 +58,32 @@ class CreationTest extends TestCase
);
$this->assertEquals(422, $response->getStatusCode());
// The response body should contain details about the failed validation
$body = (string) $response->getBody();
$this->assertJson($body);
$this->assertEquals([
'errors' => [
[
'status' => '422',
'code' => 'validation_error',
'detail' => 'validation.required',
'source' => ['pointer' => '/data/attributes/username'],
],
[
'status' => '422',
'code' => 'validation_error',
'detail' => 'validation.required',
'source' => ['pointer' => '/data/attributes/email'],
],
[
'status' => '422',
'code' => 'validation_error',
'detail' => 'validation.required',
'source' => ['pointer' => '/data/attributes/password'],
],
],
], json_decode($body, true));
}
/**