function TermAccessTest::assertTermAccess
Same name in other branches
- 9 core/modules/taxonomy/tests/src/Functional/TermAccessTest.php \Drupal\Tests\taxonomy\Functional\TermAccessTest::assertTermAccess()
- 10 core/modules/taxonomy/tests/src/Functional/TermAccessTest.php \Drupal\Tests\taxonomy\Functional\TermAccessTest::assertTermAccess()
- 11.x core/modules/taxonomy/tests/src/Functional/TermAccessTest.php \Drupal\Tests\taxonomy\Functional\TermAccessTest::assertTermAccess()
Checks access on taxonomy term.
Parameters
\Drupal\taxonomy\TermInterface $term: A taxonomy term entity.
$access_operation: The entity operation, e.g. 'view', 'edit', 'delete', etc.
bool $access_allowed: Whether the current use has access to the given operation or not.
string $access_reason: (optional) The reason of the access result.
1 call to TermAccessTest::assertTermAccess()
- TermAccessTest::testTermAccess in core/
modules/ taxonomy/ tests/ src/ Functional/ TermAccessTest.php - Test access control functionality for taxonomy terms.
File
-
core/
modules/ taxonomy/ tests/ src/ Functional/ TermAccessTest.php, line 120
Class
- TermAccessTest
- Tests the taxonomy term access permissions.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
protected function assertTermAccess(TermInterface $term, $access_operation, $access_allowed, $access_reason = '') {
$access_result = $term->access($access_operation, NULL, TRUE);
$this->assertSame($access_allowed, $access_result->isAllowed());
if ($access_reason) {
$this->assertSame($access_reason, $access_result->getReason());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.