You are here

public function EmbeddedMediaTest::testEmbedCodeBasedEmbeddedMedia in Lightning Media 8.3

Tests embedding embed code-based media, with no image options.

@dataProvider providerEmbedCodeBasedEmbeddedMedia

File

tests/src/FunctionalJavascript/EmbeddedMediaTest.php, line 75

Class

EmbeddedMediaTest
Tests embedding media items in CKEditor using the media browser.

Namespace

Drupal\Tests\lightning_media\FunctionalJavascript

Code

public function testEmbedCodeBasedEmbeddedMedia($media_type, $embed_code) {

  /** @var \Drupal\media\MediaInterface $media */
  $media = Media::create([
    'bundle' => $media_type,
    'name' => $this
      ->randomString(),
    'embed_code' => (string) $embed_code,
    'field_media_in_library' => TRUE,
  ]);
  $media
    ->setPublished()
    ->save();
  $this
    ->drupalGet('/node/add/page');
  $this
    ->open();
  $items = $this
    ->waitForItems();
  $this
    ->selectItem($items[0]);
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Place');
  $this
    ->waitForEntityBrowserToClose();
  $this
    ->waitForStandardEmbedForm();
}