You are here

public function SiteMapTest::testNodeAddition in Site map 7

Tests that a new node with a menu item gets listed at /sitemap.

File

./site_map.test, line 37
Tests for the site_map module.

Class

SiteMapTest
Test case class for sitemap tests.

Code

public function testNodeAddition() {

  // Create user.
  $this->user = $this
    ->drupalCreateUser(array(
    'administer site map',
    'access site map',
    'administer menu',
    'administer nodes',
    'create page content',
  ));
  $this
    ->drupalLogin($this->user);

  // Configure module to list items of Main menu.
  $edit = array(
    'site_map_show_menus[main-menu]' => '1',
  );
  $this
    ->drupalPost('admin/config/search/sitemap', $edit, t('Save configuration'));
  $this
    ->assertText(t('The configuration options have been saved.'));

  // Create dummy node.
  $title = $this
    ->randomName(8);
  $edit = array(
    'title' => $title,
    'menu[enabled]' => '1',
    'menu[link_title]' => $title,
  );
  $this
    ->drupalPost('node/add/page', $edit, t('Save'));

  // Check that dummy node is listed at /sitemap.
  $this
    ->drupalGet('sitemap');
  $this
    ->assertText($title);
}