You are here

protected function EmbedTestBase::setUp in Embed 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/EmbedTestBase.php, line 48

Class

EmbedTestBase
Base class for all embed tests.

Namespace

Drupal\Tests\embed\Functional

Code

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

  // Create Filtered HTML text format and enable entity_embed filter.
  $format = FilterFormat::create([
    'format' => 'embed_test',
    'name' => 'Embed format',
    'filters' => [],
  ]);
  $format
    ->save();
  $editor_group = [
    'name' => 'Embed',
    'items' => [
      'embed_test_default',
    ],
  ];
  $editor = Editor::create([
    'format' => 'embed_test',
    'editor' => 'ckeditor',
    'settings' => [
      'toolbar' => [
        'rows' => [
          [
            $editor_group,
          ],
        ],
      ],
    ],
  ]);
  $editor
    ->save();

  // Create a user with required permissions.
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer embed buttons',
    'use text format embed_test',
  ]);

  // Create a user with required permissions.
  $this->webUser = $this
    ->drupalCreateUser([
    'use text format embed_test',
  ]);

  // Set up some standard blocks for the testing theme (Classy).
  // @see https://www.drupal.org/node/507488?page=1#comment-10291517
  $this
    ->drupalPlaceBlock('local_tasks_block');
  $this
    ->drupalPlaceBlock('local_actions_block');
}