function RssTest::setUp
Same name in other branches
- 9 core/modules/taxonomy/tests/src/Functional/RssTest.php \Drupal\Tests\taxonomy\Functional\RssTest::setUp()
- 10 core/modules/taxonomy/tests/src/Functional/RssTest.php \Drupal\Tests\taxonomy\Functional\RssTest::setUp()
- 11.x core/modules/taxonomy/tests/src/Functional/RssTest.php \Drupal\Tests\taxonomy\Functional\RssTest::setUp()
Overrides TaxonomyTestBase::setUp
File
-
core/
modules/ taxonomy/ tests/ src/ Functional/ RssTest.php, line 42
Class
- RssTest
- Ensure that data added as terms appears in RSS feeds if "RSS Category" format is selected.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
protected function setUp() {
parent::setUp();
$this->drupalLogin($this->drupalCreateUser([
'administer taxonomy',
'bypass node access',
'administer content types',
'administer node display',
]));
$this->vocabulary = $this->createVocabulary();
$this->fieldName = 'taxonomy_' . $this->vocabulary
->id();
$handler_settings = [
'target_bundles' => [
$this->vocabulary
->id() => $this->vocabulary
->id(),
],
'auto_create' => TRUE,
];
$this->createEntityReferenceField('node', 'article', $this->fieldName, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
/** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */
$display_repository = \Drupal::service('entity_display.repository');
$display_repository->getFormDisplay('node', 'article')
->setComponent($this->fieldName, [
'type' => 'options_select',
])
->save();
$display_repository->getViewDisplay('node', 'article')
->setComponent($this->fieldName, [
'type' => 'entity_reference_label',
])
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.