You are here

protected function SimplenewsSourceTest::setUp in Simplenews 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Functional/SimplenewsSourceTest.php \Drupal\Tests\simplenews\Functional\SimplenewsSourceTest::setUp()

Overrides SimplenewsTestBase::setUp

File

tests/src/Functional/SimplenewsSourceTest.php, line 23

Class

SimplenewsSourceTest
Test cases for creating and sending newsletters.

Namespace

Drupal\Tests\simplenews\Functional

Code

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

  // Create the filtered_html text format.
  $filtered_html_format = \Drupal::entityTypeManager()
    ->getStorage('filter_format')
    ->create([
    'format' => 'filtered_html',
    'name' => 'Filtered HTML',
    'weight' => 0,
    'filters' => [
      // URL filter.
      'filter_url' => [
        'weight' => 0,
        'status' => 1,
      ],
      // HTML filter.
      'filter_html' => [
        'weight' => 1,
        'status' => 1,
        'allowed-values' => '',
      ],
      // Line break filter.
      'filter_autop' => [
        'weight' => 2,
        'status' => 1,
      ],
      // HTML corrector filter.
      'filter_htmlcorrector' => [
        'weight' => 10,
        'status' => 1,
      ],
    ],
  ]);
  $filtered_html_format
    ->save();
  $admin_user = $this
    ->drupalCreateUser([
    'administer newsletters',
    'send newsletter',
    'administer nodes',
    'administer simplenews subscriptions',
    'create simplenews_issue content',
    'edit any simplenews_issue content',
    'view own unpublished content',
    'delete any simplenews_issue content',
    'administer simplenews settings',
    $filtered_html_format
      ->getPermissionName(),
  ]);
  $this
    ->drupalLogin($admin_user);
}