 .../EntityResource/Comment/CommentResourceTestBase.php      | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php
index b6935a1..48f48ea 100644
--- a/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php
@@ -288,11 +288,18 @@ public function testPostDxWithoutCriticalBaseFields() {
     // https://www.drupal.org/node/2820364.
     try {
       $response = $this->request('POST', $url, $request_options);
-      // This happens on DrupalCI.
-      $this->assertSame(500, $response->getStatusCode());
+      // PHP 5: fatal error is not catchable, PHP prints it directly.
+      if (version_compare(phpversion(), '7.0') < 0) {
+        $body = (string) $response->getBody();
+        $this->assertTrue(strpos($body, 'Call to a member function get() on') !== FALSE);
+        $this->assertTrue(strpos($body, 'CommentNameConstraintValidator.php') !== FALSE);
+      }
+      else {
+        $this->assertTrue(FALSE, 'This should not be reached on PHP 7.');
+      }
     }
     catch (\Exception $e) {
-      // This happens on Wim's local machine.
+      // PHP 7: fatal error is an exception, which is caught and re-thrown for tests, by \Drupal\Core\Test\HttpClientMiddleware\TestHttpClientMiddleware.
       $this->assertSame("Error: Call to a member function get() on null\nDrupal\\comment\\Plugin\\Validation\\Constraint\\CommentNameConstraintValidator->getAnonymousContactDetailsSetting()() (Line: 96)\n", $e->getMessage());
     }
     //$response = $this->request('POST', $url, $request_options);
