summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/taxonomy/taxonomy.test')
-rw-r--r--modules/taxonomy/taxonomy.test13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 2a7f36bbb..4cfb81b28 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -1390,12 +1390,16 @@ class TaxonomyHooksTestCase extends TaxonomyWebTestCase {
function setUp() {
parent::setUp('taxonomy', 'taxonomy_test');
+ module_load_include('inc', 'taxonomy', 'taxonomy.pages');
$taxonomy_admin = $this->drupalCreateUser(array('administer taxonomy'));
$this->drupalLogin($taxonomy_admin);
}
/**
- * Test that hooks are run correctly on creating, editing and deleting a term.
+ * Test that hooks are run correctly on creating, editing, viewing,
+ * and deleting a term.
+ *
+ * @see taxonomy_test.module
*/
function testTaxonomyTermHooks() {
$vocabulary = $this->createVocabulary();
@@ -1420,6 +1424,13 @@ class TaxonomyHooksTestCase extends TaxonomyWebTestCase {
$term = taxonomy_term_load($term->tid);
$this->assertEqual($edit['antonym'], $term->antonym, 'Antonym was successfully edited.');
+ // View the term and ensure that hook_taxonomy_term_view() and
+ // hook_entity_view() are invoked.
+ $term = taxonomy_term_load($term->tid);
+ $term_build = taxonomy_term_page($term);
+ $this->assertFalse(empty($term_build['taxonomy_terms'][$term->tid]['taxonomy_test_term_view_check']), 'hook_taxonomy_term_view() was invoked when viewing the term.');
+ $this->assertFalse(empty($term_build['taxonomy_terms'][$term->tid]['taxonomy_test_entity_view_check']), 'hook_entity_view() was invoked when viewing the term.');
+
// Delete the term.
taxonomy_term_delete($term->tid);
$antonym = db_query('SELECT tid FROM {taxonomy_term_antonym} WHERE tid = :tid', array(':tid' => $term->tid))->fetchField();