MigrateVocabularyFieldTest.php in Drupal 10
File
core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateVocabularyFieldTest.php
View source
<?php
namespace Drupal\Tests\taxonomy\Kernel\Migrate\d6;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateVocabularyFieldTest extends MigrateDrupal6TestBase {
protected static $modules = [
'taxonomy',
'menu_ui',
];
protected function setUp() : void {
parent::setUp();
$this
->migrateTaxonomy();
}
public function testVocabularyField() {
$field_storage_id = 'node.field_tags';
$field_storage = FieldStorageConfig::load($field_storage_id);
$this
->assertSame($field_storage_id, $field_storage
->id());
$settings = $field_storage
->getSettings();
$this
->assertSame('taxonomy_term', $settings['target_type'], "Target type is correct.");
$this
->assertSame(1, $field_storage
->getCardinality(), "Field cardinality in 1.");
$this
->assertSame([
[
'node',
'field_tags',
],
], $this
->getMigration('d6_vocabulary_field')
->getIdMap()
->lookupDestinationIds([
4,
]), "Test IdMap");
$field_type = FieldStorageConfig::load('node.field_type');
$this
->assertInstanceOf(FieldStorageConfig::class, $field_type);
}
}