protected function MetatagXssTest::setUp in Metatag 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ MetatagXssTest.php, line 83
Class
- MetatagXssTest
- Ensures that meta tags do not allow xss vulnerabilities.
Namespace
Drupal\Tests\metatag\FunctionalCode
protected function setUp() {
parent::setUp();
// Create a user that can manage content types and create content.
$admin_permissions = [
'administer content types',
'administer nodes',
'bypass node access',
'administer meta tags',
'administer site configuration',
'access content',
'administer content types',
'administer nodes',
'administer node fields',
];
// Create and login a with the admin-ish permissions user.
$this->adminUser = $this
->drupalCreateUser($admin_permissions);
$this
->drupalLogin($this->adminUser);
// Set up a content type.
$this
->drupalCreateContentType([
'type' => 'metatag_node',
'name' => 'Test Content Type',
]);
// Add a metatag field to the content type.
$this
->drupalGet('admin/structure/types/manage/metatag_node/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'));
}