protected function EarlyDateTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/modules/taxonomy/tests/src/Functional/EarlyDateTest.php \Drupal\Tests\taxonomy\Functional\EarlyDateTest::setUp()
Overrides TaxonomyTestBase::setUp
File
- core/
modules/ taxonomy/ tests/ src/ Functional/ EarlyDateTest.php, line 28
Class
- EarlyDateTest
- Posts an article with a taxonomy term and a date prior to 1970.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Create a tags vocabulary for the 'article' content type.
$vocabulary = Vocabulary::create([
'name' => 'Tags',
'vid' => 'tags',
]);
$vocabulary
->save();
$field_name = 'field_' . $vocabulary
->id();
$handler_settings = [
'target_bundles' => [
$vocabulary
->id() => $vocabulary
->id(),
],
'auto_create' => TRUE,
];
$this
->createEntityReferenceField('node', 'article', $field_name, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
\Drupal::service('entity_display.repository')
->getFormDisplay('node', 'article')
->setComponent($field_name, [
'type' => 'entity_reference_autocomplete_tags',
])
->save();
$this
->drupalLogin($this
->drupalCreateUser([
'administer taxonomy',
'administer nodes',
'bypass node access',
]));
}