function MediaJavascriptTestBase::assertLinkToCreatedMedia

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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 = 'div[aria-label="Status message"] 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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.