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.test25
1 files changed, 24 insertions, 1 deletions
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 32ae84d66..4cfb81b28 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -98,6 +98,18 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
$edit['machine_name'] = '!&^%';
$this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save'));
$this->assertText(t('The machine-readable name must contain only lowercase letters, numbers, and underscores.'));
+
+ // Ensure that vocabulary titles are escaped properly.
+ $edit = array();
+ $edit['name'] = 'Don\'t Panic';
+ $edit['description'] = $this->randomName();
+ $edit['machine_name'] = 'don_t_panic';
+ $this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save'));
+
+ $site_name = variable_get('site_name', 'Drupal');
+ $this->drupalGet('admin/structure/taxonomy/don_t_panic');
+ $this->assertTitle(t('Don\'t Panic | @site-name', array('@site-name' => $site_name)));
+ $this->assertNoTitle(t('Don't Panic | @site-name', array('@site-name' => $site_name)));
}
/**
@@ -1378,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();
@@ -1408,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();