You are here

protected function SitemapContentTest::setUp in Sitemap 8.2

Same name and namespace in other branches
  1. 8 src/Tests/SitemapContentTest.php \Drupal\sitemap\Tests\SitemapContentTest::setUp()
  2. 2.0.x src/Tests/SitemapContentTest.php \Drupal\sitemap\Tests\SitemapContentTest::setUp()

Overrides SitemapTestBase::setUp

File

src/Tests/SitemapContentTest.php, line 31

Class

SitemapContentTest
Test configurable content on the Sitemap page.

Namespace

Drupal\sitemap\Tests

Code

protected function setUp() {
  parent::setUp();

  // Place page title block.
  $this
    ->drupalPlaceBlock('page_title_block');

  // Create filter format.
  $restricted_html_format = FilterFormat::create([
    'format' => 'restricted_html',
    'name' => 'Restricted HTML',
    'filters' => [
      'filter_html' => [
        'status' => TRUE,
        'weight' => -10,
        'settings' => [
          'allowed_html' => '<p> <br /> <strong> <a> <em> <h4>',
        ],
      ],
      'filter_autop' => [
        'status' => TRUE,
        'weight' => 0,
      ],
      'filter_url' => [
        'status' => TRUE,
        'weight' => 0,
      ],
      'filter_htmlcorrector' => [
        'status' => TRUE,
        'weight' => 10,
      ],
    ],
  ]);
  $restricted_html_format
    ->save();

  // Create user then login.
  $this->userEditor = $this
    ->drupalCreateUser([
    'administer sitemap',
    'access sitemap',
    $restricted_html_format
      ->getPermissionName(),
  ]);
  $this
    ->drupalLogin($this->userEditor);
}