diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
index d041d16..487f842 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
@@ -172,6 +172,16 @@ class TermTest extends TaxonomyTestBase {
       $this->assertText($term, 'The term was saved and appears on the node page.');
     }
 
+    // Assert that terms can be retrieved using taxonomy_get_entity_terms.
+    $node = $this->drupalGetNodeByTitle($edit['title']);
+    $retrieved_terms = taxonomy_get_entity_terms($node, 'node', 'article');
+    $retrieved_term_names = array();
+    foreach ($retrieved_terms as $term) {
+      $retrieved_term_names[] = $term->name;
+    }
+    $diff = array_diff($terms, $retrieved_term_names);
+    $this->assertTrue(empty($diff), 'The correct terms were retrieved using taxonomy_get_entity_terms().');
+
     // Get the created terms.
     $term_objects = array();
     foreach ($terms as $key => $term) {
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 8aa78df..7a5f62d 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -907,6 +907,37 @@ function taxonomy_get_tree($vid, $parent = 0, $max_depth = NULL, $load_entities
 }
 
 /**
+ * Get all the terms attached to a given entity.
+ *
+ * @param $entity
+ *   The entity to check for terms.
+ * @param $type
+ *   The type of the entity to be checked.
+ * @param $bundle
+ *   The bundle name for which to return instances.
+ *
+ * @return
+ *   A array of term objects keyed on their tid.
+ */
+function taxonomy_get_entity_terms($entity, $type, $bundle) {
+  $terms = array();
+
+  $instances = field_info_instances($type, $bundle);
+
+  foreach ($instances as $name => $instance) {
+    $field_info = field_info_field($instance['field_name']);
+    if ($field_info['type'] == 'taxonomy_term_reference') {
+      $field = field_view_field($type, $entity, $field_info['field_name']);
+      foreach ($field['#items'] as $item) {
+        $terms[$item['tid']] = $item['taxonomy_term'];
+      }
+    }
+  }
+
+  return $terms;
+}
+
+/**
  * Try to map a string to an existing term, as for glossary use.
  *
  * Provides a case-insensitive and trimmed mapping, to maximize the
