protected function HtmlTitleViewsTest::setUp in HTML Title 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ HtmlTitleViewsTest.php, line 65
Class
- HtmlTitleViewsTest
- Tests the HTML Title integration with Views.
Namespace
Drupal\Tests\html_title\FunctionalCode
protected function setUp() : void {
parent::setUp();
$this
->config('html_title.settings')
->set('allow_html_tags', '<br> <sub> <sup>')
->save();
$this
->drupalLogin($this->rootUser);
$this
->drupalCreateContentType([
'type' => 'test',
]);
// Add FR language.
ConfigurableLanguage::createFromLangcode('fr')
->save();
// Add path_prefix based language negotiation.
$this
->config('language.negotiation')
->set('url.source', 'path_prefix')
->set('url.prefixes', [
'en' => 'en',
'fr' => 'fr',
])
->save();
// Turn on content translation for test pages.
$config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'test');
$config
->setDefaultLangcode('en')
->setLanguageAlterable(TRUE)
->save();
$this->node1 = $this
->drupalCreateNode([
'title' => 'Test <sup>sup</sup>-tag',
'type' => 'test',
]);
$this->node2 = $this
->drupalCreateNode([
'title' => 'Test <sup>sup</sup>-tag, <sub>sub</sub>-tag and <br>br-tag',
'type' => 'test',
]);
$this->node3 = $this
->drupalCreateNode([
'title' => 'Test <sup>sup</sup>-tag, <sub>sub</sub>-tag, <br>br-tag and <p>p</p>-tag',
'type' => 'test',
]);
$translation = $this->node3
->addTranslation('fr', [
'title' => 'Test <sup>sup</sup>-tag, <sub>sub</sub>-tag, <br>br-tag and <p>p</p>-tag FR',
]);
$translation
->save();
$this->node4 = $this
->drupalCreateNode([
'title' => 'Test <p>p</p>-tag',
'type' => 'test',
]);
}