You are here

SitemapTest.php in Sitemap 8.2

Same filename and directory in other branches
  1. 2.0.x src/Tests/SitemapTest.php

File

src/Tests/SitemapTest.php
View source
<?php

namespace Drupal\sitemap\Tests;


/**
 * Tests the routes provided by the sitemap module.
 *
 * @group sitemap
 */
class SitemapTest extends SitemapTestBase {

  /**
   * Test user access and page locations.
   */
  public function testSitemap() {

    // Find the Sitemap page at /sitemap.
    $this
      ->drupalLogin($this->userView);
    $this
      ->drupalGet('/sitemap');
    $this
      ->assertResponse('200');

    // Unauthorized users cannot view the sitemap.
    $this
      ->drupalLogin($this->userNoAccess);
    $this
      ->drupalGet('/sitemap');
    $this
      ->assertResponse('403');
  }

  /**
   * Test user access and page locations for administrators.
   */
  public function testSitemapAdmin() {

    // Find the Sitemap settings page.
    $this
      ->drupalLogin($this->userAdmin);
    $this
      ->drupalGet('/admin/config/search/sitemap');
    $this
      ->assertResponse('200');

    // Unauthorized users cannot view the sitemap.
    $this
      ->drupalLogin($this->userView);
    $this
      ->drupalGet('/admin/config/search/sitemap');
    $this
      ->assertResponse('403');
  }

}

Classes

Namesort descending Description
SitemapTest Tests the routes provided by the sitemap module.