diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityFieldQueryTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityFieldQueryTest.php
index 9b4a91c..47a4fe2 100644
--- a/core/modules/entity/lib/Drupal/entity/Tests/EntityFieldQueryTest.php
+++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityFieldQueryTest.php
@@ -1563,4 +1563,23 @@ class EntityFieldQueryTest extends WebTestBase {
       $this->fail('Exception thrown: '. $e->getMessage());
     }
   }
+
+  /**
+   * Tests EFQ table prefixing with multiple conditions and an altered join.
+   *
+   * @see field_test_query_efq_table_prefixing_test_alter()
+   */
+  function testTablePrefixing() {
+    $query = new EntityFieldQuery();
+    $query = $query
+      ->entityCondition('entity_type', 'test_entity')
+      ->entityCondition('bundle', 'test_bundle')
+      ->entityCondition('entity_id', '1')
+      ->addTag('efq_table_prefixing_test');
+
+    $expected = array(array('test_entity', 1));
+
+    $this->assertEntityFieldQuery($query, $expected, 'An EntityFieldQuery returns the expected results when altered with an additional join on the base table.');
+  }
+
 }
diff --git a/core/modules/field/tests/modules/field_test/field_test.module b/core/modules/field/tests/modules/field_test/field_test.module
index 8a4c7cd..81f90a5 100644
--- a/core/modules/field/tests/modules/field_test/field_test.module
+++ b/core/modules/field/tests/modules/field_test/field_test.module
@@ -262,3 +262,14 @@ function field_test_field_widget_form_alter(&$element, &$form_state, $context) {
       break;
   }
 }
+
+/**
+ * Implements hook_query_TAG_alter() for tag 'efq_table_prefixing_test'.
+ *
+ * @see Drupal\entity\Tests\EntityFieldQueryTest::testTablePrefixing()
+ */
+function field_test_query_efq_table_prefixing_test_alter(&$query) {
+  // Add an additional join onto the entity base table. This will cause an
+  // exception if the EFQ does not properly prefix the base table.
+  $query->join('test_entity','te2','%alias.ftid = test_entity.ftid');
+}
