You are here

public function MediaLibraryWidgetTest::testWidgetAccess in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryWidgetTest::testWidgetAccess()

Test the media library widget access.

File

core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php, line 90

Class

MediaLibraryWidgetTest
Tests the media library widget.

Namespace

Drupal\Tests\media_library\Kernel

Code

public function testWidgetAccess() {
  $entity = EntityTest::create([
    'name' => 'sample entity',
  ]);
  $entity
    ->save();
  $element = $this
    ->buildWidgetForm($entity);
  $this
    ->assertMediaLibraryStateAccess(TRUE, $this->adminUser, $element['open_button']['#media_library_state']);
}