protected function MetatagStringTest::setUp in Metatag 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ MetatagStringTest.php, line 61
Class
- MetatagStringTest
- Ensures that the Metatag field works correctly.
Namespace
Drupal\Tests\metatag\FunctionalCode
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser($this->permissions);
$this
->drupalLogin($this->adminUser);
$this
->drupalCreateContentType([
'type' => 'page',
'display_submitted' => FALSE,
]);
// Add a Metatag field to the content type.
$this
->drupalGet('admin/structure/types');
$this
->assertSession()
->statusCodeEquals(200);
$this
->drupalGet('admin/structure/types/manage/page/fields/add-field');
$this
->assertSession()
->statusCodeEquals(200);
$edit = [
'label' => 'Metatag',
'field_name' => 'metatag_field',
'new_storage_type' => 'metatag',
];
$this
->drupalPostForm(NULL, $edit, $this
->t('Save and continue'));
$this
->drupalPostForm(NULL, [], $this
->t('Save field settings'));
$this->container
->get('entity_field.manager')
->clearCachedFieldDefinitions();
}