DefaultMobileMetaTagsTest.php in Drupal 9
File
core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php
View source
<?php
namespace Drupal\Tests\system\Functional\System;
use Drupal\Tests\BrowserTestBase;
class DefaultMobileMetaTagsTest extends BrowserTestBase {
protected $defaultMetaTags;
protected $defaultTheme = 'stark';
protected function setUp() : void {
parent::setUp();
$this->defaultMetaTags = [
'viewport' => '<meta name="viewport" content="width=device-width, initial-scale=1.0" />',
];
}
public function testDefaultMetaTagsExist() {
$this
->drupalGet('');
foreach ($this->defaultMetaTags as $name => $metatag) {
$this
->assertSession()
->responseContains($metatag);
}
}
public function testRemovingDefaultMetaTags() {
\Drupal::service('module_installer')
->install([
'system_module_test',
]);
$this
->drupalGet('');
foreach ($this->defaultMetaTags as $name => $metatag) {
$this
->assertSession()
->responseNotContains($metatag);
}
}
}