function TaxonomyImageTest::setUp
Same name in other branches
- 8.9.x core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php \Drupal\Tests\taxonomy\Functional\TaxonomyImageTest::setUp()
- 10 core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php \Drupal\Tests\taxonomy\Functional\TaxonomyImageTest::setUp()
Overrides TaxonomyTestBase::setUp
File
-
core/
modules/ taxonomy/ tests/ src/ Functional/ TaxonomyImageTest.php, line 44
Class
- TaxonomyImageTest
- Tests image upload on taxonomy terms.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
protected function setUp() : void {
parent::setUp();
$this->vocabulary = $this->createVocabulary();
$entity_type = 'taxonomy_term';
$name = 'field_test';
FieldStorageConfig::create([
'field_name' => $name,
'entity_type' => $entity_type,
'type' => 'image',
])->save();
FieldConfig::create([
'field_name' => $name,
'entity_type' => $entity_type,
'bundle' => $this->vocabulary
->id(),
'settings' => [],
])
->save();
/** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */
$display_repository = \Drupal::service('entity_display.repository');
$display_repository->getFormDisplay($entity_type, $this->vocabulary
->id())
->setComponent($name, [
'type' => 'image_image',
'settings' => [],
])
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.