function MediaLibraryWidgetTest::assertMediaLibraryStateAccess
Same name in other branches
- 8.9.x core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryWidgetTest::assertMediaLibraryStateAccess()
- 10 core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryWidgetTest::assertMediaLibraryStateAccess()
- 11.x core/modules/media_library/tests/src/Kernel/MediaLibraryWidgetTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryWidgetTest::assertMediaLibraryStateAccess()
Assert if the given user has access to the given state.
@internal
Parameters
bool $access: The access result to assert.
\Drupal\Core\Session\AccountInterface $user: The user account.
\Drupal\media_library\MediaLibraryState $state: The media library state.
Throws
\Exception
2 calls to MediaLibraryWidgetTest::assertMediaLibraryStateAccess()
- MediaLibraryWidgetTest::testRevisionableWidgetAccess in core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryWidgetTest.php - Test the media library widget access with a revisionable entity type.
- MediaLibraryWidgetTest::testWidgetAccess in core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryWidgetTest.php - Test the media library widget access.
File
-
core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryWidgetTest.php, line 143
Class
- MediaLibraryWidgetTest
- Tests the media library widget.
Namespace
Drupal\Tests\media_library\KernelCode
protected function assertMediaLibraryStateAccess(bool $access, AccountInterface $user, MediaLibraryState $state) : void {
$ui_builder = $this->container
->get('media_library.ui_builder');
$access_result = $ui_builder->checkAccess($user, $state);
$this->assertEquals($access, $access_result->isAllowed());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.