protected function MediaLibraryWidgetTest::assertMediaLibraryStateAccess in Drupal 8
Same name and namespace in other branches
- 9 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.
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 132
Class
- MediaLibraryWidgetTest
- Tests the media library widget.
Namespace
Drupal\Tests\media_library\KernelCode
protected function assertMediaLibraryStateAccess($access, $user, $state) {
$ui_builder = $this->container
->get('media_library.ui_builder');
$access_result = $ui_builder
->checkAccess($user, $state);
$this
->assertEquals($access, $access_result
->isAllowed());
}