public function assertErrorMessageTextEquals($expectedMessage, ApiTestResponse $response) { $body = $response->getBody(); $this->assertNotEmpty($body); $this->assertObjectHasAttribute('errors', $body); $this->assertNotEmpty($body->errors); $error = reset($body->errors); $this->assertObjectHasAttribute('message', $error); $this->assertContains($expectedMessage, $error->message); }