function MediaLibraryWidgetTest::testRevisionableWidgetAccess
Same name in other branches
- 9 core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryWidgetTest::testRevisionableWidgetAccess()
- 8.9.x core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryWidgetTest::testRevisionableWidgetAccess()
- 10 core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryWidgetTest::testRevisionableWidgetAccess()
Test the media library widget access with a revisionable entity type.
File
-
core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryWidgetTest.php, line 113
Class
- MediaLibraryWidgetTest
- Tests the media library widget.
Namespace
Drupal\Tests\media_library\KernelCode
public function testRevisionableWidgetAccess() : void {
$allowed_revision = EntityTestRev::create([
'name' => 'allowed_access',
]);
$allowed_revision->save();
$denied_revision = clone $allowed_revision;
$denied_revision->setNewRevision();
$denied_revision->name = 'forbid_access';
$denied_revision->save();
$element = $this->buildWidgetForm($allowed_revision);
$this->assertMediaLibraryStateAccess(TRUE, $this->adminUser, $element['open_button']['#media_library_state']);
$element = $this->buildWidgetForm($denied_revision);
$this->assertMediaLibraryStateAccess(FALSE, $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.