You are here

protected function ConvertUrlToEmbedFilterTest::setUp in URL Embed 8

Set the configuration up.

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ConvertUrlToEmbedFilterTest.php, line 31

Class

ConvertUrlToEmbedFilterTest
Tests the url_embed_convert_links filter.

Namespace

Drupal\Tests\url_embed\Functional

Code

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

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

  // Create a text format and enable the url_embed filter.
  $format = FilterFormat::create([
    'format' => 'custom_format',
    'name' => 'Custom format',
    'filters' => [
      'url_embed_convert_links' => [
        'status' => 1,
        'settings' => [
          'url_prefix' => '',
        ],
      ],
    ],
  ]);
  $format
    ->save();
  $editor_group = [
    'name' => 'URL Embed',
    'items' => [
      'url',
    ],
  ];
  $editor = Editor::create([
    'format' => 'custom_format',
    'editor' => 'ckeditor',
    'settings' => [
      'toolbar' => [
        'rows' => [
          [
            $editor_group,
          ],
        ],
      ],
    ],
  ]);
  $editor
    ->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);
}