public function XmlSitemapTaxonomyFunctionalTest::testTaxonomySettings in XML sitemap 2.x
Same name and namespace in other branches
- 8 tests/src/Functional/XmlSitemapTaxonomyFunctionalTest.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapTaxonomyFunctionalTest::testTaxonomySettings()
Test xmlsitemap settings for taxonomies.
File
- tests/
src/ Functional/ XmlSitemapTaxonomyFunctionalTest.php, line 42
Class
- XmlSitemapTaxonomyFunctionalTest
- Tests the generation of taxonomy links.
Namespace
Drupal\Tests\xmlsitemap\FunctionalCode
public function testTaxonomySettings() {
$this
->drupalLogin($this->admin_user);
// Enable XML Sitemap settings for our vocabulary.
$settings = [
'status' => '1',
'priority' => '1.0',
];
xmlsitemap_link_bundle_settings_save('taxonomy_term', 'tags', $settings);
$this
->drupalGet('admin/structure/taxonomy/manage/tags/add');
$session = $this
->assertSession();
$session
->statusCodeEquals(200);
$session
->fieldExists('xmlsitemap[status]');
$session
->fieldExists('xmlsitemap[priority]');
$session
->fieldExists('xmlsitemap[changefreq]');
$term_name = $this
->randomMachineName();
$edit = [
'name[0][value]' => $term_name,
'xmlsitemap[status]' => 'default',
'xmlsitemap[priority]' => 'default',
];
$this
->drupalPostForm(NULL, $edit, t('Save'));
$term = taxonomy_term_load_multiple_by_name($term_name, 'tags')[1];
$link = $this->linkStorage
->load('taxonomy_term', $term
->id());
$this
->assertEquals(1, (int) $link['status']);
$this
->assertEquals(1, (int) $link['priority']);
}