function MediaLibraryWidgetTest::testWidgetAccess

Same name in other branches
  1. 9 core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryWidgetTest::testWidgetAccess()
  2. 8.9.x core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryWidgetTest::testWidgetAccess()
  3. 10 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 101

Class

MediaLibraryWidgetTest
Tests the media library widget.

Namespace

Drupal\Tests\media_library\Kernel

Code

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

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