diff --git a/modules/simpletest/tests/taxonomy_test.module b/modules/simpletest/tests/taxonomy_test.module index aae13a2..6234f25 100644 --- a/modules/simpletest/tests/taxonomy_test.module +++ b/modules/simpletest/tests/taxonomy_test.module @@ -54,6 +54,36 @@ function taxonomy_test_taxonomy_term_delete($term) { ->execute(); } + +/** + * Implements hook_taxonomy_term_view(). + */ +function taxonomy_test_taxonomy_term_view($term, $view_mode, $langcode) { + if ($view_mode == 'full') { + $term->content['taxonomy_test_term_view_check'] = array( + '#prefix' => '
', + '#markup' => t('The antonym is %antonym', array('%antonym' => $term->antonym)), + '#suffix' => '
', + '#weight' => 10, + ); + } +} + +/** + * Implements hook_taxonomy_term_view(). + */ +function taxonomy_test_entity_view($entity, $type, $view_mode, $langcode) { + if ($type == 'taxonomy_term' && $view_mode == 'full') { + $entity->content['taxonomy_test_entity_view_check'] = array( + '#prefix' => '
', + '#markup' => t('The antonym is %antonym', array('%antonym' => $term->antonym)), + '#suffix' => '
', + '#weight' => 20, + ); + } +} + + /** * Implements hook_form_alter(). */ diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test index 9a89b9c..1e381ca 100644 --- a/modules/taxonomy/taxonomy.test +++ b/modules/taxonomy/taxonomy.test @@ -909,6 +909,7 @@ 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); } @@ -939,6 +940,12 @@ class TaxonomyHooksTestCase extends TaxonomyWebTestCase { $term = taxonomy_term_load($term->tid); $this->assertEqual($edit['antonym'], $term->antonym, t('Antonym was successfully edited')); + // View the term + $term = taxonomy_term_load($term->tid); + $term_build = taxonomy_term_page($term); + $this->assertFalse(empty($term_build['taxonomy_test_term_view_check']), t('Antonym was success loaded for viewing for hook_taxonomy_term_view.')); + $this->assertFalse(empty($term_build['taxonomy_test_term_view_check']), t('Antonym was success loaded for viewing for hook_entity_term_view.')); + // 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();