MigrateNodeTaxonomyTest.php in Drupal 9
File
core/modules/taxonomy/tests/src/Kernel/Migrate/d7/MigrateNodeTaxonomyTest.php
View source
<?php
namespace Drupal\Tests\taxonomy\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
use Drupal\node\Entity\Node;
use Drupal\node\NodeInterface;
class MigrateNodeTaxonomyTest extends MigrateDrupal7TestBase {
protected static $modules = [
'comment',
'datetime',
'image',
'link',
'menu_ui',
'node',
'taxonomy',
'telephone',
'text',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('file');
$this
->migrateTaxonomyTerms();
$this
->migrateUsers(FALSE);
$this
->executeMigration('d7_node:article');
}
public function testMigration() {
$node = Node::load(2);
$this
->assertInstanceOf(NodeInterface::class, $node);
$this
->assertEquals(9, $node->field_tags[0]->target_id);
$this
->assertEquals(14, $node->field_tags[1]->target_id);
$this
->assertEquals(17, $node->field_tags[2]->target_id);
}
}