diff --git a/core/modules/taxonomy/src/Tests/TermTest.php b/core/modules/taxonomy/src/Tests/TermTest.php
index bb7ec06..d6d544a 100644
--- a/core/modules/taxonomy/src/Tests/TermTest.php
+++ b/core/modules/taxonomy/src/Tests/TermTest.php
@@ -595,4 +595,24 @@ function testReSavingTags() {
     $this->assertRaw($term->getName(), 'Term is displayed after saving the node with no changes.');
   }
 
+  /**
+   * Test taxonomy_term query alter tag.
+   */
+  public function testTermQueryAlter() {
+    \Drupal::moduleHandler()->install(array('taxonomy_crud'));
+
+    // Create some terms.
+    $term_access = $this->createTerm($this->vocabulary, array('name' => 'term with access'));
+    $term_access1 = $this->createTerm($this->vocabulary, array('name' => 'another term with access'));
+    $term_no_access = $this->createTerm($this->vocabulary, array('name' => 'term with no access'));
+    $term_no_access1 = $this->createTerm($this->vocabulary, array('name' => 'another term with no access'));
+    /** @var \Drupal\taxonomy\Entity\Term[] $terms */
+    $terms = \Drupal::entityManager()->getStorage('taxonomy_term')->loadMultiple();
+    $this->assertEqual(count($terms), 2);
+    $this->assertTrue(in_array($term_access->id(), array_keys($terms)));
+    $this->assertTrue(in_array($term_access1->id(), array_keys($terms)));
+    $this->assertFalse(in_array($term_no_access->id(), array_keys($terms)));
+    $this->assertFalse(in_array($term_no_access1->id(), array_keys($terms)));
+  }
+
 }
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module b/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module
index 442ca09..ae6c9d9 100644
--- a/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module
+++ b/core/modules/taxonomy/tests/modules/taxonomy_crud/taxonomy_crud.module
@@ -5,9 +5,18 @@
  * Provides hook implementations for testing purposes.
  */
 
+use Drupal\Core\Database\Query\AlterableInterface;
+
 /**
  * Implements hook_ENTITY_TYPE_presave() for taxonomy_vocabulary entities.
  */
 function taxonomy_crud_taxonomy_vocabulary_presave(\Drupal\taxonomy\VocabularyInterface $vocabulary) {
   $vocabulary->setThirdPartySetting('taxonomy_crud', 'foo', 'bar');
 }
+
+/**
+ * Implements hook_query_TAG_alter() for taxonomy_term entities.
+ */
+function taxonomy_crud_query_taxonomy_term_alter(AlterableInterface $query) {
+  $query->condition('name', db_like('no access'), 'NOT LIKE');
+}
