function MediaAccessControlHandlerTest::assertAccess
Same name in other branches
- 9 core/modules/media/tests/src/Kernel/MediaAccessControlHandlerTest.php \Drupal\Tests\media\Kernel\MediaAccessControlHandlerTest::assertAccess()
- 10 core/modules/media/tests/src/Kernel/MediaAccessControlHandlerTest.php \Drupal\Tests\media\Kernel\MediaAccessControlHandlerTest::assertAccess()
- 11.x core/modules/media/tests/src/Kernel/MediaAccessControlHandlerTest.php \Drupal\Tests\media\Kernel\MediaAccessControlHandlerTest::assertAccess()
Asserts an access result.
Parameters
\Drupal\Core\Access\AccessResultInterface $expected_access_result: The expected access result.
string[] $expected_cache_contexts: Expected contexts.
string[] $expected_cache_tags: Expected cache tags.
\Drupal\Core\Access\AccessResultInterface $actual: The actual access result.
2 calls to MediaAccessControlHandlerTest::assertAccess()
- MediaAccessControlHandlerTest::testAccess in core/
modules/ media/ tests/ src/ Kernel/ MediaAccessControlHandlerTest.php - Tests the media access control handler.
- MediaAccessControlHandlerTest::testCreateAccess in core/
modules/ media/ tests/ src/ Kernel/ MediaAccessControlHandlerTest.php - @covers ::checkCreateAccess @dataProvider providerCreateAccess
File
-
core/
modules/ media/ tests/ src/ Kernel/ MediaAccessControlHandlerTest.php, line 94
Class
- MediaAccessControlHandlerTest
- Tests the media access control handler.
Namespace
Drupal\Tests\media\KernelCode
protected function assertAccess(AccessResultInterface $expected_access_result, array $expected_cache_contexts, array $expected_cache_tags, AccessResultInterface $actual) {
$this->assertSame($expected_access_result->isAllowed(), $actual->isAllowed());
$this->assertSame($expected_access_result->isForbidden(), $actual->isForbidden());
$this->assertSame($expected_access_result->isNeutral(), $actual->isNeutral());
$actual_cache_contexts = $actual->getCacheContexts();
sort($expected_cache_contexts);
sort($actual_cache_contexts);
$this->assertSame($expected_cache_contexts, $actual_cache_contexts);
$actual_cache_tags = $actual->getCacheTags();
sort($expected_cache_tags);
sort($actual_cache_tags);
$this->assertSame($expected_cache_tags, $actual_cache_tags);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.