protected function FeedsKernelTestBase::setUpTermReferenceField in Feeds 8.3
Installs a taxonomy term reference field.
Return value
\Drupal\taxonomy\Entity\Vocabulary The created vocabulary.
1 call to FeedsKernelTestBase::setUpTermReferenceField()
- BasicFieldSourceTest::testImportWithTaxonomyTermReferenceSource in tests/
src/ Kernel/ Feeds/ Source/ BasicFieldSourceTest.php - Tests importing using a taxonomy term reference source.
File
- tests/
src/ Kernel/ FeedsKernelTestBase.php, line 85
Class
- FeedsKernelTestBase
- Provides a base class for Feeds kernel tests.
Namespace
Drupal\Tests\feeds\KernelCode
protected function setUpTermReferenceField() {
$vocabulary = $this
->installTaxonomyModuleWithVocabulary();
// Create field for article content type.
$this
->createFieldWithStorage('field_tags', [
'type' => 'entity_reference',
'storage' => [
'settings' => [
'target_type' => 'taxonomy_term',
],
],
'field' => [
'settings' => [
'handler' => 'default',
'handler_settings' => [
// Restrict selection of terms to a single vocabulary.
'target_bundles' => [
$vocabulary
->id() => $vocabulary
->id(),
],
],
],
],
]);
return $vocabulary;
}