diff -u b/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php b/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php --- b/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php +++ b/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php @@ -281,7 +281,7 @@ /** * Performs mimimal validation of the document. */ - public function validateRequestBody($document) { + protected static function validateRequestBody(array $document) { // Ensure that the relationships key was not placed in the top level. if (isset($document['relationships']) && !empty($document['relationships'])) { throw new BadRequestHttpException("Found \"relationships\" within the document's top level. The \"relationships\" key must be within resource object."); diff -u b/tests/src/Functional/JsonApiFunctionalTest.php b/tests/src/Functional/JsonApiFunctionalTest.php --- b/tests/src/Functional/JsonApiFunctionalTest.php +++ b/tests/src/Functional/JsonApiFunctionalTest.php @@ -594,10 +594,10 @@ ], ]); $created_response = Json::decode((string) $response->getBody()); - $this->assertEquals(400, $response->getStatusCode()); + $this->assertSame(400, $response->getStatusCode()); $this->assertNotEmpty($created_response['errors']); - $this->assertEquals("Bad Request", $created_response['errors'][0]['title']); - $this->assertEquals("Found \"relationships\" within the document's top level. The \"relationships\" key must be within resource object.", $created_response['errors'][0]['detail']); + $this->assertSame("Bad Request", $created_response['errors'][0]['title']); + $this->assertSame("Found \"relationships\" within the document's top level. The \"relationships\" key must be within resource object.", $created_response['errors'][0]['detail']); // 6.2 "type" not included in "data" $missing_type = $body; unset($missing_type['data']['type']); @@ -610,10 +610,10 @@ ], ]); $created_response = Json::decode((string) $response->getBody()); - $this->assertEquals(400, $response->getStatusCode()); + $this->assertSame(400, $response->getStatusCode()); $this->assertNotEmpty($created_response['errors']); - $this->assertEquals("Bad Request", $created_response['errors'][0]['title']); - $this->assertEquals("Resource object must include a \"type\".", $created_response['errors'][0]['detail']); + $this->assertSame("Bad Request", $created_response['errors'][0]['title']); + $this->assertSame("Resource object must include a \"type\".", $created_response['errors'][0]['detail']); // 7. Successful PATCH. $body = [ 'data' => [