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.test33
1 files changed, 17 insertions, 16 deletions
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 2679da3e7..fda432120 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -151,7 +151,8 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
// Check the created vocabulary.
$vocabularies = taxonomy_get_vocabularies();
$vid = $vocabularies[count($vocabularies)-1]->vid;
- $vocabulary = taxonomy_vocabulary_load($vid, TRUE);
+ drupal_static_reset('taxonomy_vocabulary_load_multiple');
+ $vocabulary = taxonomy_vocabulary_load($vid);
$this->assertTrue($vocabulary, t('Vocabulary found in database'));
// Delete the vocabulary.
@@ -163,7 +164,8 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
// Confirm deletion.
$this->drupalPost(NULL, NULL, t('Delete'));
$this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), t('Vocabulary deleted'));
- $this->assertFalse(taxonomy_vocabulary_load($vid, TRUE), t('Vocabulary is not found in the database'));
+ drupal_static_reset('taxonomy_vocabulary_load_multiple');
+ $this->assertFalse(taxonomy_vocabulary_load($vid), t('Vocabulary is not found in the database'));
}
}
@@ -213,7 +215,7 @@ public static function getInfo() {
* Ensure that the vocabulary static reset works correctly.
*/
function testTaxonomyVocabularyLoadStaticReset() {
- $original_vocabulary = taxonomy_vocabulary_load($this->vocabulary->vid, TRUE);
+ $original_vocabulary = taxonomy_vocabulary_load($this->vocabulary->vid);
$this->assertTrue(is_object($original_vocabulary), t('Vocabulary loaded successfully'));
$this->assertEqual($this->vocabulary->name, $original_vocabulary->name, t('Vocabulary loaded successfully'));
@@ -223,8 +225,8 @@ public static function getInfo() {
$vocabulary->description = $this->randomName();
taxonomy_vocabulary_save($vocabulary);
- // Load the vocabulary with $reset TRUE.
- $new_vocabulary = taxonomy_vocabulary_load($original_vocabulary->vid, TRUE);
+ // Load the vocabulary.
+ $new_vocabulary = taxonomy_vocabulary_load($original_vocabulary->vid);
$this->assertEqual($new_vocabulary->name, $vocabulary->name);
$this->assertEqual($new_vocabulary->name, $vocabulary->name);
@@ -316,7 +318,7 @@ class TaxonomyTermUnitTest extends TaxonomyWebTestCase {
$this->assertEqual(taxonomy_term_count_nodes($term2->tid), 1, t('Term has one valid node association.'));
// Confirm that term3 is not associated with any nodes.
- //$this->assertEqual(taxonomy_term_count_nodes($term3->tid), NULL, t('Term is not associated with any nodes'));
+ $this->assertEqual(taxonomy_term_count_nodes($term3->tid), 0, t('Term is not associated with any nodes'));
// Set term3 as the parent of term1.
$term1->parent = array($term3->tid);
@@ -326,29 +328,27 @@ class TaxonomyTermUnitTest extends TaxonomyWebTestCase {
$children = taxonomy_get_children($term3->tid);
$this->assertTrue(isset($children[$term1->tid]), t('Term 3 saved as parent of term 1'));
- // Reset the taxonomy_get_tree() static cache to avoid stale data, since
- // the hierarchy has been updated during this page request.
- $this->assertEqual(count(taxonomy_get_tree($term3->vid, $term3->tid, NULL, TRUE)), 1, t('Term 3 has one child term'));
+ $this->assertEqual(count(taxonomy_get_tree($term3->vid, $term3->tid)), 1, t('Term 3 has one child term'));
// Confirm that term3's parental relationship with term1 leads to a
// node assocation being counted.
- $this->assertEqual(taxonomy_term_count_nodes($term3->tid, NULL, TRUE), 1, t('Term has one valid node association due to child term.'));
+ $this->assertEqual(taxonomy_term_count_nodes($term3->tid, NULL), 1, t('Term has one valid node association due to child term.'));
// Set term3 as the parent of term2.
$term2->parent = array($term3->tid);
taxonomy_term_save($term2);
// term3 should now have two node associations counted.
- $this->assertEqual(taxonomy_term_count_nodes($term3->tid, NULL, TRUE), 2, t('Term has two valid node associations due to child terms.'));
+ $this->assertEqual(taxonomy_term_count_nodes($term3->tid, NULL), 2, t('Term has two valid node associations due to child terms.'));
// Save node1 with both child taxonomy terms, this should still result
// in term3 having two node associations.
$node1->taxonomy = array($term1->tid, $term2->tid);
node_save($node1);
- $this->assertEqual(taxonomy_term_count_nodes($term3->tid, NULL, TRUE), 2, t('Term has two valid node associations.'));
+ $this->assertEqual(taxonomy_term_count_nodes($term3->tid, NULL), 2, t('Term has two valid node associations.'));
// Confirm that the node type argument returns a single node association.
- $this->assertEqual(taxonomy_term_count_nodes($term3->tid, 'page', TRUE), 1, t("Term is associated with one node of type 'page'."));
+ $this->assertEqual(taxonomy_term_count_nodes($term3->tid, 'page'), 1, t("Term is associated with one node of type 'page'."));
}
}
@@ -608,11 +608,11 @@ class TaxonomyLoadMultipleUnitTest extends TaxonomyWebTestCase {
// Remove one term from the array, then delete it.
$deleted = array_shift($terms3);
taxonomy_term_delete($deleted->tid);
- $deleted_term = taxonomy_term_load($deleted->tid, TRUE);
+ $deleted_term = taxonomy_term_load($deleted->tid);
$this->assertFalse($deleted_term);
// Load terms from the vocabulary by vid.
- $terms4 = taxonomy_term_load_multiple(NULL, array('vid' => $vocabulary->vid), TRUE);
+ $terms4 = taxonomy_term_load_multiple(NULL, array('vid' => $vocabulary->vid));
$this->assertTrue(count($terms4 == 4), t('Correct number of terms were loaded.'));
$this->assertFalse(isset($terms4[$deleted->tid]));
@@ -669,7 +669,8 @@ class TaxonomyHooksTestCase extends DrupalWebTestCase {
'antonyms' => 'Short',
);
$this->drupalPost('taxonomy/term/' . $term->tid . '/edit', $edit, t('Save'));
- $term = taxonomy_term_load($term->tid, TRUE);
+ taxonomy_terms_static_reset();
+ $term = taxonomy_term_load($term->tid);
$this->assertTrue(in_array($edit['antonyms'], $term->antonyms), t('Antonym was successfully edited'));
// Delete the term.