private function MediaLibraryAccessTest::assertAccess in Drupal 8
Same name and namespace in other branches
- 9 core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAccessTest::assertAccess()
Asserts various aspects of an access result.
Parameters
\Drupal\Core\Access\AccessResult $access_result: The access result.
bool $is_allowed: The expected access status.
string $expected_reason: (optional) The expected reason attached to the access result.
string[] $expected_cache_tags: (optional) The expected cache tags attached to the access result.
string[] $expected_cache_contexts: (optional) The expected cache contexts attached to the access result.
5 calls to MediaLibraryAccessTest::assertAccess()
- MediaLibraryAccessTest::testEditorOpenerAccess in core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryAccessTest.php - @covers \Drupal\media_library\MediaLibraryEditorOpener::checkAccess
- MediaLibraryAccessTest::testFieldWidgetEntityCreateAccess in core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryAccessTest.php - Tests that the field widget opener respects entity creation permissions.
- MediaLibraryAccessTest::testFieldWidgetEntityEditAccess in core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryAccessTest.php - Tests that the field widget opener respects entity-specific access.
- MediaLibraryAccessTest::testFieldWidgetEntityFieldAccess in core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryAccessTest.php - Tests that the field widget opener respects entity field-level access.
- MediaLibraryAccessTest::testViewAccess in core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryAccessTest.php - Tests that media library access respects the media_library view.
File
- core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryAccessTest.php, line 385
Class
- MediaLibraryAccessTest
- Tests the media library access.
Namespace
Drupal\Tests\media_library\KernelCode
private function assertAccess(AccessResult $access_result, $is_allowed, $expected_reason = NULL, array $expected_cache_tags = [], array $expected_cache_contexts = []) {
$this
->assertSame($is_allowed, $access_result
->isAllowed());
if ($access_result instanceof AccessResultReasonInterface && isset($expected_reason)) {
$this
->assertSame($expected_reason, $access_result
->getReason());
}
$this
->assertSame($expected_cache_tags, $access_result
->getCacheTags());
$this
->assertSame($expected_cache_contexts, $access_result
->getCacheContexts());
}