diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
index 0bb5b16..a4bfd85 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
@@ -209,6 +209,22 @@ public function testInvalidSpecifier() {
   }
 
   /**
+   * Tests a non-existent field name in a complex query relationship.
+   */
+  public function testInvalidFieldName() {
+    // Check that non-existent field names in a complex relationship query
+    // throws a meaningful exception.
+    $non_existent_field_name = $this->randomMachineName();
+    $this->factory->get('entity_test')
+      ->condition("$non_existent_field_name.entity:user.name.value", $this->randomString(), '=')
+      ->execute();
+
+    $this->factory->get('entity_test')
+      ->condition("user_id.entity:user.$non_existent_field_name.value", $this->randomString(), '=')
+      ->execute();
+  }
+
+  /**
    * Assert the results.
    *
    * @param array $expected
