3 namespace Drupal\Tests\node\Kernel\Migrate\d6;
5 use Drupal\Core\Field\Entity\BaseFieldOverride;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
7 use Drupal\node\Entity\Node;
10 * Test migrating node settings into the base_field_bundle_override config entity.
12 * @group migrate_drupal_6
14 class MigrateNodeBundleSettingsTest extends MigrateDrupal6TestBase {
19 public static $modules = ['menu_ui'];
24 protected function setUp() {
26 $this->installConfig(['node']);
27 $this->executeMigration('d6_node_type');
29 // Create a config entity that already exists.
30 BaseFieldOverride::create([
31 'field_name' => 'promote',
32 'entity_type' => 'node',
36 $this->executeMigrations([
37 'd6_node_setting_promote',
38 'd6_node_setting_status',
39 'd6_node_setting_sticky'
44 * Tests Drupal 6 node type settings to Drupal 8 migration.
46 public function testNodeBundleSettings() {
47 // Test settings on test_page bundle.
48 $node = Node::create(['type' => 'test_page']);
49 $this->assertIdentical(1, $node->status->value);
50 $this->assertIdentical(1, $node->promote->value);
51 $this->assertIdentical(1, $node->sticky->value);
53 // Test settings for test_story bundle.
54 $node = Node::create(['type' => 'test_story']);
55 $this->assertIdentical(1, $node->status->value);
56 $this->assertIdentical(1, $node->promote->value);
57 $this->assertIdentical(0, $node->sticky->value);
59 // Test settings for the test_event bundle.
60 $node = Node::create(['type' => 'test_event']);
61 $this->assertIdentical(0, $node->status->value);
62 $this->assertIdentical(0, $node->promote->value);
63 $this->assertIdentical(1, $node->sticky->value);