public function XmlSitemapMultilingualNodeTest::testNodeLanguageData in XML sitemap 8
Same name and namespace in other branches
- 2.x tests/src/Functional/XmlSitemapMultilingualNodeTest.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapMultilingualNodeTest::testNodeLanguageData()
Test language for sitemap node links.
File
- tests/
src/ Functional/ XmlSitemapMultilingualNodeTest.php, line 59
Class
- XmlSitemapMultilingualNodeTest
- Tests the generation of multilingual nodes.
Namespace
Drupal\Tests\xmlsitemap\FunctionalCode
public function testNodeLanguageData() {
$this
->drupalLogin($this->admin_user);
$node = $this
->drupalCreateNode([]);
$this
->drupalPostForm('node/' . $node
->id() . '/edit', [
'langcode[0][value]' => 'en',
], t('Save'));
$link = $this
->assertSitemapLink('node', $node
->id(), [
'status' => 0,
'access' => 1,
]);
$this
->assertSame('en', $link['language']);
$this
->drupalPostForm('node/' . $node
->id() . '/edit', [
'langcode[0][value]' => 'fr',
], t('Save'));
$link = $this
->assertSitemapLink('node', $node
->id(), [
'status' => 0,
'access' => 1,
]);
$this
->assertSame('fr', $link['language']);
}