You are here

protected function MediaJavascriptTestBase::assertLinkToCreatedMedia in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php \Drupal\Tests\media\FunctionalJavascript\MediaJavascriptTestBase::assertLinkToCreatedMedia()
  2. 10 core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php \Drupal\Tests\media\FunctionalJavascript\MediaJavascriptTestBase::assertLinkToCreatedMedia()

Asserts that a link to a new media item is displayed in the messages area.

Return value

string The link URL.

6 calls to MediaJavascriptTestBase::assertLinkToCreatedMedia()
MediaDisplayTest::testMediaDisplay in core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php
Tests basic media display.
MediaSourceAudioVideoTest::testAudioTypeCreation in core/modules/media/tests/src/FunctionalJavascript/MediaSourceAudioVideoTest.php
Check the Audio source functionality.
MediaSourceAudioVideoTest::testVideoTypeCreation in core/modules/media/tests/src/FunctionalJavascript/MediaSourceAudioVideoTest.php
Check the Video source functionality.
MediaSourceFileTest::testMediaFileSource in core/modules/media/tests/src/FunctionalJavascript/MediaSourceFileTest.php
Tests the file media source.
MediaSourceImageTest::testMediaImageSource in core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php
Tests the image media source.

... See full list

File

core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php, line 52

Class

MediaJavascriptTestBase
Base class for Media functional JavaScript tests.

Namespace

Drupal\Tests\media\FunctionalJavascript

Code

protected function assertLinkToCreatedMedia() {
  $assert_session = $this
    ->assertSession();
  $selector = '.messages a';

  // Get the canonical media entity URL from the creation message.
  $link = $assert_session
    ->elementExists('css', $selector);
  $assert_session
    ->elementAttributeExists('css', $selector, 'href');
  return $link
    ->getAttribute('href');
}