diff --git a/core/modules/taxonomy/taxonomy.test b/core/modules/taxonomy/taxonomy.test index 44050b9..de37ac1 100644 --- a/core/modules/taxonomy/taxonomy.test +++ b/core/modules/taxonomy/taxonomy.test @@ -6,7 +6,7 @@ */ /** - * Class with common helper methods. + * Provides common helper methods for Taxonomy module tests. */ class TaxonomyWebTestCase extends DrupalWebTestCase { @@ -61,7 +61,7 @@ class TaxonomyWebTestCase extends DrupalWebTestCase { } /** - * Tests for the taxonomy vocabulary interface. + * Tests the taxonomy vocabulary interface. */ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase { @@ -95,7 +95,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase { $edit['description'] = $this->randomName(); $edit['machine_name'] = $machine_name; $this->drupalPost(NULL, $edit, t('Save')); - $this->assertRaw(t('Created new vocabulary %name.', array('%name' => $edit['name'])), 'Vocabulary created successfully'); + $this->assertRaw(t('Created new vocabulary %name.', array('%name' => $edit['name'])), 'Vocabulary created successfully.'); // Edit the vocabulary. $this->drupalGet('admin/structure/taxonomy'); @@ -156,7 +156,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase { taxonomy_vocabulary_delete($key); } // Confirm that no vocabularies are found in the database. - $this->assertFalse(taxonomy_vocabulary_load_multiple(FALSE), 'No vocabularies found in the database'); + $this->assertFalse(taxonomy_vocabulary_load_multiple(FALSE), 'No vocabularies found in the database.'); $this->drupalGet('admin/structure/taxonomy'); // Check the default message for no vocabularies. $this->assertText(t('No vocabularies available.'), 'No vocabularies were found.'); @@ -179,7 +179,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, 'Vocabulary found in database'); + $this->assertTrue($vocabulary, 'Vocabulary found in database.'); // Delete the vocabulary. $edit = array(); @@ -189,7 +189,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase { // Confirm deletion. $this->drupalPost(NULL, NULL, t('Delete')); - $this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), 'Vocabulary deleted'); + $this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), 'Vocabulary deleted.'); entity_get_controller('taxonomy_vocabulary')->resetCache(); $this->assertFalse(taxonomy_vocabulary_load($vid), t('Vocabulary is not found in the database')); } @@ -233,7 +233,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), 'Vocabulary is an object'); + $this->assertTrue(!empty($vocabulary) && is_object($vocabulary), 'Vocabulary is an object.'); $this->assertTrue($vocabulary->vid == $vid, 'Valid vocabulary vid is the same as our previously invalid one.'); } @@ -276,8 +276,8 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase { */ function testTaxonomyVocabularyLoadStaticReset() { $original_vocabulary = taxonomy_vocabulary_load($this->vocabulary->vid); - $this->assertTrue(is_object($original_vocabulary), 'Vocabulary loaded successfully'); - $this->assertEqual($this->vocabulary->name, $original_vocabulary->name, 'Vocabulary loaded successfully'); + $this->assertTrue(is_object($original_vocabulary), 'Vocabulary loaded successfully.'); + $this->assertEqual($this->vocabulary->name, $original_vocabulary->name, 'Vocabulary loaded successfully.'); // Change the name and description. $vocabulary = $original_vocabulary; @@ -293,7 +293,7 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase { // Delete the vocabulary. taxonomy_vocabulary_delete($this->vocabulary->vid); $vocabularies = taxonomy_vocabulary_load_multiple(FALSE); - $this->assertTrue(!isset($vocabularies[$this->vocabulary->vid]), 'The vocabulary was deleted'); + $this->assertTrue(!isset($vocabularies[$this->vocabulary->vid]), 'The vocabulary was deleted.'); } /** @@ -687,9 +687,9 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // Save, creating the terms. $this->drupalPost('node/add/article', $edit, t('Save')); - $this->assertRaw(t('@type %title has been created.', array('@type' => t('Article'), '%title' => $edit["title"])), 'The node was created successfully'); + $this->assertRaw(t('@type %title has been created.', array('@type' => t('Article'), '%title' => $edit["title"])), 'The node was created successfully.'); foreach ($terms as $term) { - $this->assertText($term, 'The term was saved and appears on the node page'); + $this->assertText($term, 'The term was saved and appears on the node page.'); } // Get the created terms. @@ -807,7 +807,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { $terms = taxonomy_term_load_multiple_by_name($edit['name']); $term = reset($terms); - $this->assertNotNull($term, 'Term found in database'); + $this->assertNotNull($term, '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); @@ -859,7 +859,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // Assert that the term no longer exists. $this->drupalGet('taxonomy/term/' . $term->tid); - $this->assertResponse(404, 'The taxonomy term page was not found'); + $this->assertResponse(404, 'The taxonomy term page was not found.'); } /** @@ -940,7 +940,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase { // Check that the term was successfully created. $terms = taxonomy_term_load_multiple_by_name($edit['name']); $term = reset($terms); - $this->assertNotNull($term, 'Term found in database'); + $this->assertNotNull($term, 'Term found in database.'); $this->assertEqual($edit['name'], $term->name, 'Term name was successfully saved.'); $this->assertEqual($edit['description[value]'], $term->description, 'Term description was successfully saved.'); // Check that the parent tid is still there. The other parent () is @@ -1364,8 +1364,8 @@ class TaxonomyLoadMultipleUnitTest extends TaxonomyWebTestCase { // Load the same terms again by tid. $terms2 = taxonomy_term_load_multiple(array_keys($terms)); - $this->assertTrue($count == count($terms2), 'Five terms were loaded by tid'); - $this->assertEqual($terms, $terms2, 'Both arrays contain the same terms'); + $this->assertTrue($count == count($terms2), 'Five terms were loaded by tid.'); + $this->assertEqual($terms, $terms2, '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)); @@ -1385,7 +1385,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, 'One term was loaded'); + $this->assertEqual(count($loaded_terms), 1, 'One term was loaded.'); $loaded_term = reset($loaded_terms); $this->assertEqual($term->tid, $loaded_term->tid, 'Term loaded by name successfully.'); } @@ -1425,7 +1425,7 @@ class TaxonomyHooksTestCase extends TaxonomyWebTestCase { $this->drupalPost('admin/structure/taxonomy/' . $vocabulary->machine_name . '/add', $edit, t('Save')); $terms = taxonomy_term_load_multiple_by_name($edit['name']); $term = reset($terms); - $this->assertEqual($term->antonym, $edit['antonym'], 'Antonym was loaded into the term object'); + $this->assertEqual($term->antonym, $edit['antonym'], 'Antonym was loaded into the term object.'); // Update the term with a different antonym. $edit = array( @@ -1435,7 +1435,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, 'Antonym was successfully edited'); + $this->assertEqual($edit['antonym'], $term->antonym, 'Antonym was successfully edited.'); // Delete the term. taxonomy_term_delete($term->tid); @@ -1510,10 +1510,10 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase { $entity->{$this->field_name}[$langcode][0]['tid'] = $term->tid; try { field_attach_validate('test_entity', $entity); - $this->pass('Correct term does not cause validation error'); + $this->pass('Correct term does not cause validation error.'); } catch (FieldValidationException $e) { - $this->fail('Correct term does not cause validation error'); + $this->fail('Correct term does not cause validation error.'); } $entity = field_test_create_stub_entity(); @@ -1521,10 +1521,10 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase { $entity->{$this->field_name}[$langcode][0]['tid'] = $bad_term->tid; try { field_attach_validate('test_entity', $entity); - $this->fail('Wrong term causes validation error'); + $this->fail('Wrong term causes validation error.'); } catch (FieldValidationException $e) { - $this->pass('Wrong term causes validation error'); + $this->pass('Wrong term causes validation error.'); } } @@ -1538,7 +1538,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase { // Display creation form. $langcode = LANGUAGE_NOT_SPECIFIED; $this->drupalGet('test-entity/add/test-bundle'); - $this->assertFieldByName("{$this->field_name}[$langcode]", '', 'Widget is displayed'); + $this->assertFieldByName("{$this->field_name}[$langcode]", '', 'Widget is displayed.'); // Submit with some value. $edit = array( @@ -1547,7 +1547,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)), 'Entity was created'); + $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created.'); // Display the object. $entity = field_test_entity_test_load($id); @@ -1555,7 +1555,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, 'Term name is displayed'); + $this->assertText($term->name, 'Term name is displayed.'); // Delete the vocabulary and verify that the widget is gone. taxonomy_vocabulary_delete($this->vocabulary->vid);