protected function TaxonomyAccessTest::setUp in Workbench Access 8
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ TaxonomyAccessTest.php, line 83
Class
- TaxonomyAccessTest
- Tests workbench_access integration with taxonomy.
Namespace
Drupal\Tests\workbench_access\KernelCode
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('taxonomy_term');
$this->accessControlledVocabulary = Vocabulary::create([
'vid' => 'tags',
'name' => 'Tags',
]);
$this->accessControlledVocabulary
->save();
$this->nonAccessControlledVocabulary = Vocabulary::create([
'vid' => 'categories',
'name' => 'Categories',
]);
$this->nonAccessControlledVocabulary
->save();
$this
->installConfig([
'filter',
'workbench_access',
]);
$this->scheme = AccessScheme::create([
'id' => 'editorial_section',
'label' => 'Editorial section',
'plural_label' => 'Editorial sections',
'scheme' => 'taxonomy',
'scheme_settings' => [
'vocabularies' => [
'workbench_access',
],
'fields' => [
[
'entity_type' => 'taxonomy_term',
'bundle' => 'tags',
'field' => 'field_workbench_access',
],
],
],
]);
$this->scheme
->save();
$this
->installEntitySchema('user');
$this
->installEntitySchema('section_association');
$this
->installSchema('system', [
'key_value',
'sequences',
]);
$this->vocabulary = $this
->setUpVocabulary();
$this->accessHandler = $this->container
->get('entity_type.manager')
->getAccessControlHandler('taxonomy_term');
$this
->setUpTaxonomyFieldForEntityType('taxonomy_term', 'tags', $this->vocabulary
->id());
$this->userStorage = \Drupal::service('workbench_access.user_section_storage');
}