public function SiteMapCategoriesTest::testNodeCountsByCategory in Site map 8
Tests node counts by category.
File
- src/
Tests/ SiteMapCategoriesTest.php, line 52
Class
- SiteMapCategoriesTest
- Test case class for site map categories tests.
Namespace
Drupal\site_map\TestsCode
public function testNodeCountsByCategory() {
// Create dummy node.
$title = $this
->randomString();
$edit = array(
'title[0][value]' => $title,
'menu[enabled]' => TRUE,
'menu[title]' => $title,
$this->field_tags_name => implode(',', $this->tags),
);
$this
->drupalPostForm('node/add/article', $edit, t('Save and publish'));
// Assert that node counts are included in the site map by default.
$this
->drupalGet('/sitemap');
$this
->assertEqual(substr_count($this
->getTextContent(), '(1)'), 3, 'Node counts are included');
// Configure module to hide node counts.
$edit = array(
'show_count' => FALSE,
);
$this
->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));
// Assert that node counts are not included in the site map.
$this
->drupalGet('sitemap');
$this
->assertEqual(substr_count($this
->getTextContent(), '(1)'), 0, 'Node counts are not included');
}