class MigrateNodeBundleSettingsTest
Same name and namespace in other branches
- 11.x core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeBundleSettingsTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeBundleSettingsTest
Test migrating node settings into the base_field_bundle_override config entity.
@group migrate_drupal_6
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase extends \Drupal\migrate\MigrateMessageInterface implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase implements \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait implements \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeBundleSettingsTest implements \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait implements \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase implements \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase extends \Drupal\migrate\MigrateMessageInterface implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of MigrateNodeBundleSettingsTest
File
-
core/
modules/ node/ tests/ src/ Kernel/ Migrate/ d6/ MigrateNodeBundleSettingsTest.php, line 14
Namespace
Drupal\Tests\node\Kernel\Migrate\d6View source
class MigrateNodeBundleSettingsTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'menu_ui',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->installConfig([
'node',
]);
$this->executeMigration('d6_node_type');
// Create a config entity that already exists.
BaseFieldOverride::create([
'field_name' => 'promote',
'entity_type' => 'node',
'bundle' => 'page',
])->save();
$this->executeMigrations([
'd6_node_setting_promote',
'd6_node_setting_status',
'd6_node_setting_sticky',
]);
}
/**
* Tests Drupal 6 node type settings to Drupal 8 migration.
*/
public function testNodeBundleSettings() {
// Test settings on test_page bundle.
$node = Node::create([
'type' => 'test_page',
]);
$this->assertSame(1, $node->status->value);
$this->assertSame(1, $node->promote->value);
$this->assertSame(1, $node->sticky->value);
// Test settings for test_story bundle.
$node = Node::create([
'type' => 'test_story',
]);
$this->assertSame(1, $node->status->value);
$this->assertSame(1, $node->promote->value);
$this->assertSame(0, $node->sticky->value);
// Test settings for the test_event bundle.
$node = Node::create([
'type' => 'test_event',
]);
$this->assertSame(0, $node->status->value);
$this->assertSame(0, $node->promote->value);
$this->assertSame(1, $node->sticky->value);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.