diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test index 97cfe44..cb6b10d 100644 --- a/modules/taxonomy/taxonomy.test +++ b/modules/taxonomy/taxonomy.test @@ -137,7 +137,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase { taxonomy_vocabulary_delete($key); } // Confirm that no vocabularies are found in the database. - $this->assertFalse(taxonomy_get_vocabularies(), t('No vocabularies found in the database')); + $this->assertFalse(taxonomy_get_vocabularies(), t('No vocabularies found in the database.')); $this->drupalGet('admin/structure/taxonomy'); // Check the default message for no vocabularies. $this->assertText(t('No vocabularies available.'), t('No vocabularies were found.')); @@ -160,7 +160,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase { $vid = $vocabularies[count($vocabularies)-1]->vid; entity_get_controller('taxonomy_vocabulary')->resetCache(); $vocabulary = taxonomy_vocabulary_load($vid); - $this->assertTrue($vocabulary, t('Vocabulary found in database')); + $this->assertTrue($vocabulary, t('Vocabulary found in database.')); // Delete the vocabulary. $edit = array(); @@ -170,9 +170,9 @@ 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->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), t('Vocabulary deleted.')); entity_get_controller('taxonomy_vocabulary')->resetCache(); - $this->assertFalse(taxonomy_vocabulary_load($vid), t('Vocabulary is not found in the database')); + $this->assertFalse(taxonomy_vocabulary_load($vid), t('Vocabulary is not found in the database.')); } } @@ -214,7 +214,7 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase { // Load the vocabulary with the same $vid from earlier. // This should return a vocabulary object since it now matches a real vid. $vocabulary = taxonomy_vocabulary_load($vid); - $this->assertTrue(!empty($vocabulary) && is_object($vocabulary), t('Vocabulary is an object')); + $this->assertTrue(!empty($vocabulary) && is_object($vocabulary), t('Vocabulary is an object.')); $this->assertTrue($vocabulary->vid == $vid, t('Valid vocabulary vid is the same as our previously invalid one.')); } @@ -228,7 +228,7 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase { } // Assert that there are no terms left. - $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {taxonomy_term_data}')->fetchField()); + $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {taxonomy_term_data}')->fetchField(), t('No terms found after deleting.')); // Create a new vocabulary and add a few terms to it. $vocabulary = $this->createVocabulary(); @@ -244,12 +244,12 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase { taxonomy_term_save($terms[4]); // Assert that there are now 5 terms. - $this->assertEqual(5, db_query('SELECT COUNT(*) FROM {taxonomy_term_data}')->fetchField()); + $this->assertEqual(5, db_query('SELECT COUNT(*) FROM {taxonomy_term_data}')->fetchField(), t('Five terms created successfully.')); taxonomy_vocabulary_delete($vocabulary->vid); // Assert that there are no terms left. - $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {taxonomy_term_data}')->fetchField()); + $this->assertEqual(0, db_query('SELECT COUNT(*) FROM {taxonomy_term_data}')->fetchField(), t('Terms deletion when vocabulary is removed.')); } /** @@ -257,8 +257,8 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase { */ function testTaxonomyVocabularyLoadStaticReset() { $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')); + $this->assertTrue(is_object($original_vocabulary), t('Vocabulary loaded successfully.')); + $this->assertEqual($this->vocabulary->name, $original_vocabulary->name, t('Vocabulary loaded successfully.')); // Change the name and description. $vocabulary = $original_vocabulary; @@ -268,13 +268,12 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase { // 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); + $this->assertEqual($new_vocabulary->name, $vocabulary->name, t('Vocabulary name loaded successfully.')); // Delete the vocabulary. taxonomy_vocabulary_delete($this->vocabulary->vid); $vocabularies = taxonomy_get_vocabularies(); - $this->assertTrue(!isset($vocabularies[$this->vocabulary->vid]), t('The vocabulary was deleted')); + $this->assertTrue(!isset($vocabularies[$this->vocabulary->vid]), t('The vocabulary was deleted.')); } /** @@ -405,7 +404,7 @@ class TaxonomyTermUnitTest extends TaxonomyWebTestCase { // Delete a valid term. taxonomy_term_delete($valid_term->tid); $terms = taxonomy_term_load_multiple(array(), array('vid' => $vocabulary->vid)); - $this->assertTrue(empty($terms), 'Vocabulary is empty after deletion'); + $this->assertTrue(empty($terms), 'Vocabulary is empty after deletion.'); // Delete an invalid term. Should not throw any notices. taxonomy_term_delete(42); @@ -595,7 +594,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // Preview and verify the terms appear but are not created. $this->drupalPost('node/add/page', $edit, t('Preview')); foreach ($terms as $term) { - $this->assertText($term, t('The term appears on the node preview')); + $this->assertText($term, t('The term appears on the node preview.')); } $tree = taxonomy_get_tree($this->vocabulary->vid); $this->assertTrue(empty($tree), t('The terms are not created on preview.')); @@ -605,9 +604,9 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // Save, creating the terms. $this->drupalPost('node/add/page', $edit, t('Save')); - $this->assertRaw(t('@type %title has been created.', array('@type' => t('Basic page'), '%title' => $edit["title"])), t('The node was created successfully')); + $this->assertRaw(t('@type %title has been created.', array('@type' => t('Basic page'), '%title' => $edit["title"])), t('The node was created successfully.')); foreach ($terms as $term) { - $this->assertText($term, t('The term was saved and appears on the node page')); + $this->assertText($term, t('The term was saved and appears on the node page.')); } // Get the created terms. @@ -623,7 +622,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $this->drupalGet('node/' . $node->nid); foreach ($term_names as $term_name) { - $this->assertText($term_name, t('The term %name appears on the node page after one term %deleted was deleted', array('%name' => $term_name, '%deleted' => $term1->name))); + $this->assertText($term_name, t('The term %name appears on the node page after one term %deleted was deleted.', array('%name' => $term_name, '%deleted' => $term1->name))); } $this->assertNoText($term1->name, t('The deleted term %name does not appear on the node page.', array('%name' => $term1->name))); @@ -650,7 +649,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $terms = taxonomy_get_term_by_name($edit['name']); $term = reset($terms); - $this->assertNotNull($term, t('Term found in database')); + $this->assertNotNull($term, t('Term found in database.')); // Submitting a term takes us to the add page; we need the List page. $this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->machine_name); @@ -698,7 +697,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // Assert that the term no longer exists. $this->drupalGet('taxonomy/term/' . $term->tid); - $this->assertResponse(404, t('The taxonomy term page was not found')); + $this->assertResponse(404, t('The taxonomy term page was not found.')); } /** @@ -784,11 +783,11 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // Try to load an invalid term name. $terms = taxonomy_get_term_by_name('Banana'); - $this->assertFalse($terms); + $this->assertFalse($terms, t('Invalid term name not loaded.')); // Try to load the term using a substring of the name. $terms = taxonomy_get_term_by_name(drupal_substr($term->name, 2)); - $this->assertFalse($terms); + $this->assertFalse($terms, t('Substring term name not loaded.')); } } @@ -832,18 +831,18 @@ class TaxonomyLoadMultipleUnitTest extends TaxonomyWebTestCase { // Load the same terms again by tid. $terms2 = taxonomy_term_load_multiple(array_keys($terms)); - $this->assertTrue($count == count($terms2), t('Five terms were loaded by tid')); - $this->assertEqual($terms, $terms2, t('Both arrays contain the same terms')); + $this->assertTrue($count == count($terms2), t('Five terms were loaded by tid.')); + $this->assertEqual($terms, $terms2, t('Both arrays contain the same terms.')); // Load the terms by tid, with a condition on vid. $terms3 = taxonomy_term_load_multiple(array_keys($terms2), array('vid' => $vocabulary->vid)); - $this->assertEqual($terms2, $terms3); + $this->assertEqual($terms2, $terms3, t('Term loaded by tid and with a condition on vid.')); // 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); - $this->assertFalse($deleted_term); + $this->assertFalse($deleted_term, t('One term was deleted successfully.')); // Load terms from the vocabulary by vid. $terms4 = taxonomy_term_load_multiple(NULL, array('vid' => $vocabulary->vid)); @@ -853,7 +852,7 @@ class TaxonomyLoadMultipleUnitTest extends TaxonomyWebTestCase { // Create a single term and load it by name. $term = $this->createTerm($vocabulary); $loaded_terms = taxonomy_term_load_multiple(array(), array('name' => $term->name)); - $this->assertEqual(count($loaded_terms), 1, t('One term was loaded')); + $this->assertEqual(count($loaded_terms), 1, t('One term was loaded.')); $loaded_term = reset($loaded_terms); $this->assertEqual($term->tid, $loaded_term->tid, t('Term loaded by name successfully.')); } @@ -891,7 +890,7 @@ class TaxonomyHooksTestCase extends TaxonomyWebTestCase { $this->drupalPost('admin/structure/taxonomy/' . $vocabulary->machine_name . '/add', $edit, t('Save')); $terms = taxonomy_get_term_by_name($edit['name']); $term = reset($terms); - $this->assertEqual($term->antonym, $edit['antonym'], t('Antonym was loaded into the term object')); + $this->assertEqual($term->antonym, $edit['antonym'], t('Antonym was loaded into the term object.')); // Update the term with a different antonym. $edit = array( @@ -901,7 +900,7 @@ class TaxonomyHooksTestCase extends TaxonomyWebTestCase { $this->drupalPost('taxonomy/term/' . $term->tid . '/edit', $edit, t('Save')); taxonomy_terms_static_reset(); $term = taxonomy_term_load($term->tid); - $this->assertEqual($edit['antonym'], $term->antonym, t('Antonym was successfully edited')); + $this->assertEqual($edit['antonym'], $term->antonym, t('Antonym was successfully edited.')); // Delete the term. taxonomy_term_delete($term->tid); @@ -974,10 +973,10 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase { $entity->{$this->field_name}[$langcode][0]['tid'] = $term->tid; try { field_attach_validate('test_entity', $entity); - $this->pass(t('Correct term does not cause validation error')); + $this->pass(t('Correct term does not cause validation error.')); } catch (FieldValidationException $e) { - $this->fail(t('Correct term does not cause validation error')); + $this->fail(t('Correct term does not cause validation error.')); } $entity = field_test_create_stub_entity(); @@ -985,10 +984,10 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase { $entity->{$this->field_name}[$langcode][0]['tid'] = $bad_term->tid; try { field_attach_validate('test_entity', $entity); - $this->fail(t('Wrong term causes validation error')); + $this->fail(t('Wrong term causes validation error.')); } catch (FieldValidationException $e) { - $this->pass(t('Wrong term causes validation error')); + $this->pass(t('Wrong term causes validation error.')); } } @@ -1002,7 +1001,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase { // Display creation form. $langcode = LANGUAGE_NONE; $this->drupalGet('test-entity/add/test-bundle'); - $this->assertFieldByName("{$this->field_name}[$langcode]", '', t('Widget is displayed')); + $this->assertFieldByName("{$this->field_name}[$langcode]", '', t('Widget is displayed.')); // Submit with some value. $edit = array( @@ -1011,7 +1010,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase { $this->drupalPost(NULL, $edit, t('Save')); preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; - $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created')); + $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created.')); // Display the object. $entity = field_test_entity_test_load($id); @@ -1019,7 +1018,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase { field_attach_prepare_view('test_entity', $entities, 'full'); $entity->content = field_attach_view('test_entity', $entity, 'full'); $this->content = drupal_render($entity->content); - $this->assertText($term->name, t('Term name is displayed')); + $this->assertText($term->name, t('Term name is displayed.')); } /**