protected function PBTKernelTestBase::createRelationOneGrantedTerm in Permissions by Term 8.2
Same name and namespace in other branches
- 8 tests/src/Kernel/PBTKernelTestBase.php \Drupal\Tests\permissions_by_term\Kernel\PBTKernelTestBase::createRelationOneGrantedTerm()
4 calls to PBTKernelTestBase::createRelationOneGrantedTerm()
- AccessCheckTest::testDisabledRequireAllTermsGranted in tests/
src/ Kernel/ AccessCheckTest.php - AccessCheckTest::testRequireAllTermsGrantedWithRestrictedTerms in tests/
src/ Kernel/ AccessCheckTest.php - AccessStorageTest::testTidsByNidRetrieval in tests/
src/ Kernel/ AccessStorageTest.php - TermHandlerTest::testGetTidsBoundForAllNids in tests/
src/ Kernel/ TermHandlerTest.php
File
- tests/
src/ Kernel/ PBTKernelTestBase.php, line 176
Class
- PBTKernelTestBase
- Class PBTKernelTestBase
Namespace
Drupal\Tests\permissions_by_term\KernelCode
protected function createRelationOneGrantedTerm() : void {
$term = Term::create([
'name' => 'term1',
'vid' => 'test',
]);
$term
->save();
$tids[] = $term
->id();
$this->accessStorage
->addTermPermissionsByUserIds([
\Drupal::service('current_user')
->id(),
], $term
->id());
$term = Term::create([
'name' => 'term2',
'vid' => 'test',
]);
$term
->save();
$tids[] = $term
->id();
$term = Term::create([
'name' => 'term3',
'vid' => 'test2',
]);
$term
->save();
$tids[] = $term
->id();
$this->accessStorage
->addTermPermissionsByUserIds([
99,
], $term
->id());
$node = Node::create([
'type' => 'page',
'title' => 'test_title',
'field_tags' => [
[
'target_id' => $tids[0],
],
[
'target_id' => $tids[1],
],
],
'field_tags2' => [
[
'target_id' => $tids[2],
],
],
]);
$node
->save();
$this
->setNidOneGrantedTerm($node
->id());
}