Commit 5ef08242 authored by webchick's avatar webchick

Issue #1965510 by TR, shanethehat, DyanneNova: Fix punctuation in Taxonomy...

Issue #1965510 by TR, shanethehat, DyanneNova: Fix punctuation in Taxonomy module tests' assertion sentences.
parent 9d37b122
......@@ -47,7 +47,7 @@ function testTaxonomyEfq() {
'bundle' => $this->vocabulary->id(),
);
$term = _field_create_entity_from_ids($ids);
$this->assertEqual($term->id(), $tid, 'Taxonomy term can be created based on the IDs');
$this->assertEqual($term->id(), $tid, 'Taxonomy term can be created based on the IDs.');
// Create a second vocabulary and five more terms.
$vocabulary2 = $this->createVocabulary();
......@@ -69,6 +69,6 @@ function testTaxonomyEfq() {
'bundle' => $vocabulary2->id(),
);
$term = _field_create_entity_from_ids($ids);
$this->assertEqual($term->id(), $tid, 'Taxonomy term can be created based on the IDs');
$this->assertEqual($term->id(), $tid, 'Taxonomy term can be created based on the IDs.');
}
}
......@@ -86,10 +86,10 @@ public function testTaxonomyTermReferenceItem() {
$entity = entity_load('entity_test', $entity->id());
$this->assertTrue($entity->field_test_taxonomy instanceof FieldItemListInterface, 'Field implements interface.');
$this->assertTrue($entity->field_test_taxonomy[0] instanceof FieldItemInterface, 'Field item implements interface.');
$this->assertEqual($entity->field_test_taxonomy->target_id, $this->term->id());
$this->assertEqual($entity->field_test_taxonomy->entity->name->value, $this->term->name->value);
$this->assertEqual($entity->field_test_taxonomy->entity->id(), $tid);
$this->assertEqual($entity->field_test_taxonomy->entity->uuid(), $this->term->uuid());
$this->assertEqual($entity->field_test_taxonomy->target_id, $this->term->id(), 'Field item contains the expected TID.');
$this->assertEqual($entity->field_test_taxonomy->entity->name->value, $this->term->name->value, 'Field item entity contains the expected name.');
$this->assertEqual($entity->field_test_taxonomy->entity->id(), $tid, 'Field item entity contains the expected ID.');
$this->assertEqual($entity->field_test_taxonomy->entity->uuid(), $this->term->uuid(), 'Field item entity contains the expected UUID.');
// Change the name of the term via the reference.
$new_name = $this->randomName();
......@@ -97,7 +97,7 @@ public function testTaxonomyTermReferenceItem() {
$entity->field_test_taxonomy->entity->save();
// Verify it is the correct name.
$term = entity_load('taxonomy_term', $tid);
$this->assertEqual($term->name->value, $new_name);
$this->assertEqual($term->name->value, $new_name, 'The name of the term was changed.');
// Make sure the computed term reflects updates to the term id.
$term2 = entity_create('taxonomy_term', array(
......@@ -108,8 +108,8 @@ public function testTaxonomyTermReferenceItem() {
$term2->save();
$entity->field_test_taxonomy->target_id = $term2->id();
$this->assertEqual($entity->field_test_taxonomy->entity->id(), $term2->id());
$this->assertEqual($entity->field_test_taxonomy->entity->name->value, $term2->name->value);
$this->assertEqual($entity->field_test_taxonomy->entity->id(), $term2->id(), 'Field item entity contains the new TID.');
$this->assertEqual($entity->field_test_taxonomy->entity->name->value, $term2->name->value, 'Field item entity contains the new name.');
}
}
......@@ -87,7 +87,7 @@ function testTaxonomyTermFieldMultipleVocabularies() {
// Submit an entity with both terms.
$this->drupalGet('entity_test/add');
$this->assertFieldByName("{$this->field_name}[]", '', 'Widget is displayed');
$this->assertFieldByName("{$this->field_name}[]", '', 'Widget is displayed.');
$edit = array(
'user_id' => mt_rand(0, 10),
'name' => $this->randomName(),
......@@ -130,7 +130,7 @@ function testTaxonomyTermFieldMultipleVocabularies() {
// The widget should still be displayed.
$this->drupalGet('entity_test/add');
$this->assertFieldByName("{$this->field_name}[]", '', 'Widget is still displayed');
$this->assertFieldByName("{$this->field_name}[]", '', 'Widget is still displayed.');
// Term 1 should still pass validation.
$edit = array(
......
......@@ -127,7 +127,7 @@ function testTaxonomyTermFieldWidgets() {
// Delete the vocabulary and verify that the widget is gone.
$this->vocabulary->delete();
$this->drupalGet('entity_test/add');
$this->assertNoFieldByName($this->field_name, '', 'Widget is not displayed');
$this->assertNoFieldByName($this->field_name, '', 'Widget is not displayed.');
}
/**
......
......@@ -54,7 +54,7 @@ function testTermLanguage() {
// Add a term.
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add');
// Check that we have the language selector.
$this->assertField('edit-langcode', t('The language selector field was found on the page'));
$this->assertField('edit-langcode', t('The language selector field was found on the page.'));
// Submit the term.
$edit = array(
'name' => $this->randomName(),
......@@ -63,7 +63,7 @@ function testTermLanguage() {
$this->drupalPostForm(NULL, $edit, t('Save'));
$terms = taxonomy_term_load_multiple_by_name($edit['name']);
$term = reset($terms);
$this->assertEqual($term->language()->id, $edit['langcode']);
$this->assertEqual($term->language()->id, $edit['langcode'], 'The term contains the correct langcode.');
// Check if on the edit page the language is correct.
$this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
......@@ -87,7 +87,7 @@ function testDefaultTermLanguage() {
);
$this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/edit', $edit, t('Save'));
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add');
$this->assertOptionSelected('edit-langcode', 'bb');
$this->assertOptionSelected('edit-langcode', 'bb', 'The expected langcode was selected.');
// Make the default language of the terms to be the current interface.
$edit = array(
......@@ -96,9 +96,9 @@ function testDefaultTermLanguage() {
);
$this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/edit', $edit, t('Save'));
$this->drupalGet('aa/admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add');
$this->assertOptionSelected('edit-langcode', 'aa');
$this->assertOptionSelected('edit-langcode', 'aa', "The expected langcode, 'aa', was selected.");
$this->drupalGet('bb/admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add');
$this->assertOptionSelected('edit-langcode', 'bb');
$this->assertOptionSelected('edit-langcode', 'bb', "The expected langcode, 'bb', was selected.");
// Change the default language of the site and check if the default terms
// language is still correctly selected.
......@@ -114,6 +114,6 @@ function testDefaultTermLanguage() {
);
$this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/edit', $edit, t('Save'));
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add');
$this->assertOptionSelected('edit-langcode', 'cc');
$this->assertOptionSelected('edit-langcode', 'cc', "The expected langcode, 'cc', was selected.");
}
}
......@@ -171,12 +171,12 @@ function testNodeTermCreationAndDeletion() {
// Verify the placeholder is there.
$this->drupalGet('node/add/article');
$this->assertRaw('placeholder="Start typing here."');
$this->assertRaw('placeholder="Start typing here."', 'Placeholder is present.');
// Preview and verify the terms appear but are not created.
$this->drupalPostForm(NULL, $edit, t('Preview'));
foreach ($terms as $term) {
$this->assertText($term, 'The term appears on the node preview');
$this->assertText($term, 'The term appears on the node preview.');
}
$tree = taxonomy_get_tree($this->vocabulary->id());
$this->assertTrue(empty($tree), 'The terms are not created on preview.');
......@@ -211,7 +211,7 @@ function testNodeTermCreationAndDeletion() {
$this->drupalGet('node/' . $node->id());
foreach ($term_names as $term_name) {
$this->assertText($term_name, format_string('The term %name appears on the node page after two terms, %deleted1 and %deleted2, were deleted', array('%name' => $term_name, '%deleted1' => $term_objects['term1']->label(), '%deleted2' => $term_objects['term2']->label())));
$this->assertText($term_name, format_string('The term %name appears on the node page after two terms, %deleted1 and %deleted2, were deleted.', array('%name' => $term_name, '%deleted1' => $term_objects['term1']->label(), '%deleted2' => $term_objects['term2']->label())));
}
$this->assertNoText($term_objects['term1']->label(), format_string('The deleted term %name does not appear on the node page.', array('%name' => $term_objects['term1']->label())));
$this->assertNoText($term_objects['term2']->label(), format_string('The deleted term %name does not appear on the node page.', array('%name' => $term_objects['term2']->label())));
......@@ -261,8 +261,8 @@ function testTermAutocompletion() {
// The result order is not guaranteed, so check each term separately.
$result = $this->drupalGet($path, array('query' => array('q' => $input)));
$data = drupal_json_decode($result);
$this->assertEqual($data[$first_term->label()], check_plain($first_term->label()), 'Autocomplete returned the first matching term');
$this->assertEqual($data[$second_term->label()], check_plain($second_term->label()), 'Autocomplete returned the second matching term');
$this->assertEqual($data[$first_term->label()], check_plain($first_term->label()), 'Autocomplete returned the first matching term.');
$this->assertEqual($data[$second_term->label()], check_plain($second_term->label()), 'Autocomplete returned the second matching term.');
// Try to autocomplete a term name that matches first term.
// We should only get the first term in a json encoded string.
......@@ -469,10 +469,10 @@ function testTaxonomyGetTermByName() {
// Try to load an invalid term name.
$terms = taxonomy_term_load_multiple_by_name('Banana');
$this->assertFalse($terms);
$this->assertFalse($terms, 'No term loaded with an invalid name.');
// Try to load the term using a substring of the name.
$terms = taxonomy_term_load_multiple_by_name(drupal_substr($term->label(), 2));
$terms = taxonomy_term_load_multiple_by_name(drupal_substr($term->label(), 2), 'No term loaded with a substring of the name.');
$this->assertFalse($terms);
// Create a new term in a different vocabulary with the same name.
......
......@@ -87,11 +87,11 @@ protected function getNewEntityValues($langcode) {
public function testTranslationUI() {
parent::testTranslationUI();
// Make sure that no row was inserted for taxonomy vocabularies, which do
// Make sure that no row was inserted for taxonomy vocabularies which do
// not have translations enabled.
$rows = db_query('SELECT * FROM {content_translation}')->fetchAll();
foreach ($rows as $row) {
$this->assertEqual('taxonomy_term', $row->entity_type);
$this->assertEqual('taxonomy_term', $row->entity_type, 'Row contains a taxonomy term.');
}
}
......@@ -118,9 +118,9 @@ function testTranslateLinkVocabularyAdminPage() {
// Verify translation links.
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id());
$this->assertResponse(200);
$this->assertLinkByHref('term/' . $translatable_tid . '/translations');
$this->assertLinkByHref('term/' . $translatable_tid . '/edit');
$this->assertResponse(200, 'The translatable vocabulary page was found.');
$this->assertLinkByHref('term/' . $translatable_tid . '/translations', 0, 'The translations link exists for a translatable vocabulary.');
$this->assertLinkByHref('term/' . $translatable_tid . '/edit', 0, 'The edit link exists for a translatable vocabulary.');
$this->drupalGet('admin/structure/taxonomy/manage/' . $untranslatable_vocabulary->id());
$this->assertResponse(200);
......
......@@ -52,7 +52,7 @@ function testVocabularyLanguage() {
$this->drupalGet('admin/structure/taxonomy/add');
// Check that we have the language selector available.
$this->assertField('edit-langcode', 'The language selector field was found on the page');
$this->assertField('edit-langcode', 'The language selector field was found on the page.');
// Create the vocabulary.
$vid = drupal_strtolower($this->randomName());
......@@ -97,8 +97,8 @@ function testVocabularyDefaultLanguageForTerms() {
// Check that the language settings were saved.
$language_settings = language_get_default_configuration('taxonomy_term', $edit['vid']);
$this->assertEqual($language_settings['langcode'], 'bb');
$this->assertEqual($language_settings['language_show'], TRUE);
$this->assertEqual($language_settings['langcode'], 'bb', 'The langcode was saved.');
$this->assertTrue($language_settings['language_show'], 'The visibility setting was saved.');
// Check that the correct options are selected in the interface.
$this->assertOptionSelected('edit-default-language-langcode', 'bb', 'The correct default language for the terms of this vocabulary is selected.');
......@@ -113,8 +113,8 @@ function testVocabularyDefaultLanguageForTerms() {
// And check again the settings and also the interface.
$language_settings = language_get_default_configuration('taxonomy_term', $vid);
$this->assertEqual($language_settings['langcode'], 'aa');
$this->assertEqual($language_settings['language_show'], FALSE);
$this->assertEqual($language_settings['langcode'], 'aa', 'The langcode was saved.');
$this->assertFalse($language_settings['language_show'], 'The visibility setting was saved.');
$this->drupalGet('admin/structure/taxonomy/manage/' . $vid . '/edit');
$this->assertOptionSelected('edit-default-language-langcode', 'aa', 'The correct default language for the terms of this vocabulary is selected.');
......@@ -130,7 +130,7 @@ function testVocabularyDefaultLanguageForTerms() {
// Check that we have the new settings.
$new_settings = language_get_default_configuration('taxonomy_term', $vid);
$this->assertEqual($new_settings['langcode'], 'authors_default');
$this->assertEqual($new_settings['language_show'], FALSE);
$this->assertEqual($new_settings['langcode'], 'authors_default', 'The langcode was saved.');
$this->assertFalse($new_settings['language_show'], 'The new visibility setting was saved.');
}
}
......@@ -72,8 +72,8 @@ function testVocabularyInterface() {
$this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save'));
$site_name = \Drupal::config('system.site')->get('name');
$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)));
$this->assertTitle(t('Don\'t Panic | @site-name', array('@site-name' => $site_name)), 'The page title contains the escaped character.');
$this->assertNoTitle(t('Don't Panic | @site-name', array('@site-name' => $site_name)), 'The page title does not contain an encoded character.');
}
/**
......
......@@ -45,7 +45,7 @@ function testTaxonomyVocabularyDeleteWithTerms() {
}
// 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(), 'There are no terms remaining.');
// Create a new vocabulary and add a few terms to it.
$vocabulary = $this->createVocabulary();
......@@ -61,12 +61,12 @@ function testTaxonomyVocabularyDeleteWithTerms() {
$terms[4]->save();
// 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(), 'There are 5 terms found.');
$vocabulary->delete();
// 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(), 'All terms are deleted.');
}
/**
......@@ -85,8 +85,7 @@ function testTaxonomyVocabularyLoadStaticReset() {
// Load the vocabulary.
$new_vocabulary = entity_load('taxonomy_vocabulary', $original_vocabulary->id());
$this->assertEqual($new_vocabulary->name, $vocabulary->name);
$this->assertEqual($new_vocabulary->name, $vocabulary->name);
$this->assertEqual($new_vocabulary->name, $vocabulary->name, 'The vocabulary was loaded.');
// Delete the vocabulary.
$this->vocabulary->delete();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment