public function MediaContextualLinksTest::testMediaContextualLinks in Drupal 8
Same name and namespace in other branches
- 9 core/modules/media/tests/src/Functional/MediaContextualLinksTest.php \Drupal\Tests\media\Functional\MediaContextualLinksTest::testMediaContextualLinks()
- 10 core/modules/media/tests/src/Functional/MediaContextualLinksTest.php \Drupal\Tests\media\Functional\MediaContextualLinksTest::testMediaContextualLinks()
Tests contextual links.
File
- core/
modules/ media/ tests/ src/ Functional/ MediaContextualLinksTest.php, line 29
Class
- MediaContextualLinksTest
- Tests views contextual links on media items.
Namespace
Drupal\Tests\media\FunctionalCode
public function testMediaContextualLinks() {
\Drupal::configFactory()
->getEditable('media.settings')
->set('standalone_url', TRUE)
->save(TRUE);
$this->container
->get('router.builder')
->rebuild();
// Create a media type.
$mediaType = $this
->createMediaType('test');
// Create a media item.
$media = Media::create([
'bundle' => $mediaType
->id(),
'name' => 'Unnamed',
]);
$media
->save();
$user = $this
->drupalCreateUser([
'administer media',
'access contextual links',
]);
$this
->drupalLogin($user);
$this
->drupalGet('media/' . $media
->id());
$this
->assertSession()
->elementAttributeContains('css', 'div[data-contextual-id]', 'data-contextual-id', 'media:media=' . $media
->id() . ':');
}