public function MetatagFieldTestBase::testGlobalDefaultsInheritance in Metatag 8
Confirm that the global default values work correctly.
Specifically when there are no entity or bundle defaults available.
File
- tests/
src/ Functional/ MetatagFieldTestBase.php, line 207
Class
- MetatagFieldTestBase
- Base class for ensuring that the Metatag field works correctly.
Namespace
Drupal\Tests\metatag\FunctionalCode
public function testGlobalDefaultsInheritance() {
// First we set global defaults.
$this
->drupalGet('admin/config/search/metatag/global');
$session = $this
->assertSession();
$session
->statusCodeEquals(200);
$global_values = [
'metatag_test_tag' => 'Global description',
];
$this
->drupalPostForm(NULL, $global_values, 'Save');
$session
->pageTextContains('Saved the Global Metatag defaults.');
// Add the field to this entity type.
$this
->addField();
// Now when we create an entity, global defaults are used to fill the form
// fields.
$this
->drupalGet($this->entityAddPath);
$session
->statusCodeEquals(200);
$session
->fieldValueEquals('field_metatag[0][basic][metatag_test_tag]', $global_values['metatag_test_tag']);
}