You are here

public function MediaBrowserEmbedCodeWidgetTest::testDisambiguation in Lightning Media 8.3

Overrides MediaBrowserWidgetTestBase::testDisambiguation

File

tests/src/Functional/MediaBrowserEmbedCodeWidgetTest.php, line 76

Class

MediaBrowserEmbedCodeWidgetTest
@group lightning_media

Namespace

Drupal\Tests\lightning_media\Functional

Code

public function testDisambiguation() {
  $page = $this
    ->getSession()
    ->getPage();
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalGet('/entity-browser/modal/media_browser');
  $assert_session
    ->statusCodeEquals(200);
  $this
    ->chooseWidget();
  $page
    ->fillField('input', 'https://www.youtube.com/watch?v=zQ1_IbFFbzA');
  $page
    ->pressButton('Update');
  $assert_session
    ->statusCodeEquals(200);
  $assert_session
    ->fieldNotExists('Name');
  $page
    ->selectFieldOption('Bundle', 'Test Video 2');
  $page
    ->pressButton('Update');
  $assert_session
    ->statusCodeEquals(200);
  $assert_session
    ->fieldNotExists('Bundle');
  $page
    ->fillField('Name', 'Foobaz');
  $page
    ->pressButton('Place');
  $assert_session
    ->statusCodeEquals(200);
  $this
    ->assertMediaCount(1, [
    'bundle' => 'test_video_2',
    'name' => 'Foobaz',
  ]);
}