protected function SitemapTaxonomyTermsTest::linkSettingsTest in Sitemap 8.2
Same name and namespace in other branches
- 2.0.x src/Tests/SitemapTaxonomyTermsTest.php \Drupal\sitemap\Tests\SitemapTaxonomyTermsTest::linkSettingsTest()
Helper function for testing link settings.
2 calls to SitemapTaxonomyTermsTest::linkSettingsTest()
- SitemapTaxonomyTermsTest::testNestedTermLinks in src/
Tests/ SitemapTaxonomyTermsTest.php - Tests the nested term link settings.
- SitemapTaxonomyTermsTest::testTermLinks in src/
Tests/ SitemapTaxonomyTermsTest.php - Tests the term link settings.
File
- src/
Tests/ SitemapTaxonomyTermsTest.php, line 220
Class
- SitemapTaxonomyTermsTest
- Tests the display of taxonomies based on sitemap settings.
Namespace
Drupal\sitemap\TestsCode
protected function linkSettingsTest() {
// Confirm that terms without content are not linked by default.
$this
->drupalGet('/sitemap');
foreach ($this->terms as $term) {
$this
->assertSession()
->linkNotExists($term
->label());
}
// Test 'always display links'.
$vid = $this->vocabulary
->id();
$this
->saveSitemapForm([
"plugins[vocabulary:{$vid}][settings][always_link]" => TRUE,
]);
$this
->drupalGet('/sitemap');
foreach ($this->terms as $term) {
$this
->assertSession()
->linkExists($term
->label());
}
// Test that terms with content are linked...
$this
->createNodeWithTerms($this->terms);
$this
->drupalGet('/sitemap');
foreach ($this->terms as $term) {
$this
->assertSession()
->linkExists($term
->label());
}
// ... even when always_link is disabled.
$this
->saveSitemapForm([
"plugins[vocabulary:{$vid}][settings][always_link]" => FALSE,
]);
$this
->drupalGet('/sitemap');
foreach ($this->terms as $term) {
$this
->assertSession()
->linkExists($term
->label());
}
}