protected function XmlSitemapListBuilderTest::setUp in XML sitemap 8
Same name and namespace in other branches
- 2.x tests/src/Functional/XmlSitemapListBuilderTest.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapListBuilderTest::setUp()
Overrides XmlSitemapTestBase::setUp
File
- tests/
src/ Functional/ XmlSitemapListBuilderTest.php, line 31
Class
- XmlSitemapListBuilderTest
- Tests the sitemaps list builder.
Namespace
Drupal\Tests\xmlsitemap\FunctionalCode
protected function setUp() {
parent::setUp();
$this->entityTypeManager = $this->container
->get('entity_type.manager');
$this->admin_user = $this
->drupalCreateUser([
'administer languages',
'access administration pages',
'administer site configuration',
'administer xmlsitemap',
'access content',
]);
$this
->drupalLogin($this->admin_user);
$this->languageManager = $this->container
->get('language_manager');
if (!$this->languageManager
->getLanguage('fr')) {
// Add a new language.
ConfigurableLanguage::createFromLangcode('fr')
->save();
}
if (!$this->languageManager
->getLanguage('en')) {
// Add a new language.
ConfigurableLanguage::createFromLangcode('en')
->save();
}
$edit = [
'site_default_language' => 'en',
];
$this
->drupalPostForm('admin/config/regional/language', $edit, t('Save configuration'));
// Enable URL language detection and selection.
$edit = [
'language_interface[enabled][language-url]' => '1',
];
$this
->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
}