function TermTest::testReSavingTags in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/taxonomy/src/Tests/TermTest.php \Drupal\taxonomy\Tests\TermTest::testReSavingTags()
Tests that editing and saving a node with no changes works correctly.
File
- core/
modules/ taxonomy/ src/ Tests/ TermTest.php, line 529 - Contains \Drupal\taxonomy\Tests\TermTest.
Class
- TermTest
- Tests load, save and delete for taxonomy terms.
Namespace
Drupal\taxonomy\TestsCode
function testReSavingTags() {
// Enable tags in the vocabulary.
$field = $this->field;
entity_get_form_display($field
->getTargetEntityTypeId(), $field
->getTargetBundle(), 'default')
->setComponent($field
->getName(), array(
'type' => 'entity_reference_autocomplete_tags',
))
->save();
// Create a term and a node using it.
$term = $this
->createTerm($this->vocabulary);
$edit = array();
$edit['title[0][value]'] = $this
->randomMachineName(8);
$edit['body[0][value]'] = $this
->randomMachineName(16);
$edit[$this->field
->getName() . '[target_id]'] = $term
->getName();
$this
->drupalPostForm('node/add/article', $edit, t('Save'));
// Check that the term is displayed when editing and saving the node with no
// changes.
$this
->clickLink(t('Edit'));
$this
->assertRaw($term
->getName(), 'Term is displayed when editing the node.');
$this
->drupalPostForm(NULL, array(), t('Save'));
$this
->assertRaw($term
->getName(), 'Term is displayed after saving the node with no changes.');
}