You are here

public function MediaEmbedFilterTest::testOnlyDrupalMediaTagProcessed in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTest::testOnlyDrupalMediaTagProcessed()

Tests that only <drupal-media> tags are processed.

See also

\Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::testOnlyDrupalMediaTagProcessed()

File

core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php, line 362

Class

MediaEmbedFilterTest
@coversDefaultClass \Drupal\media\Plugin\Filter\MediaEmbed @group media

Namespace

Drupal\Tests\media\Kernel

Code

public function testOnlyDrupalMediaTagProcessed() {
  $content = $this
    ->createEmbedCode([
    'data-entity-type' => 'media',
    'data-entity-uuid' => $this->embeddedEntity
      ->uuid(),
  ]);
  $content = str_replace('drupal-media', 'drupal-entity', $content);
  $filter_result = $this
    ->processText($content, 'en', [
    'media_embed',
  ]);

  // If input equals output, the filter didn't change anything.
  $this
    ->assertSame($content, $filter_result
    ->getProcessedText());
}