You are here

protected function TestBase::setUp in Responsive Tables Filter 8

A set up for all tests.

Overrides BrowserTestBase::setUp

File

tests/src/Functional/TestBase.php, line 45
Contains \Drupal\responsive_tables_filter\Tests\TestBase.

Class

TestBase
Base class for all responsive_tables_filter tests.

Namespace

Drupal\Tests\responsive_tables_filter\Functional

Code

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

  // Create a page content type.
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);

  // Create a text format and enable the responsive_tables_filter filter.
  $format = FilterFormat::create([
    'format' => 'custom_format',
    'name' => 'Custom format',
    'filters' => [
      'filter_html' => [
        'status' => 1,
        'settings' => [
          'allowed_html' => '<a href> <p> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <h3 id> <table class additional> <th> <tr> <td> <thead> <tbody> <tfoot>',
        ],
      ],
      'filter_responsive_tables_filter' => [
        'status' => 1,
        'settings' => [
          'tablesaw_type' => $this->mode,
        ],
      ],
    ],
  ]);
  $format
    ->save();

  // Create a user with required permissions.
  $this->webUser = $this
    ->drupalCreateUser([
    'access content',
    'create page content',
    'use text format custom_format',
  ]);
  $this
    ->drupalLogin($this->webUser);
}