MigrateNodeBundleSettingsTest.php in Zircon Profile 8
File
core/modules/node/src/Tests/Migrate/d6/MigrateNodeBundleSettingsTest.php
View source
<?php
namespace Drupal\node\Tests\Migrate\d6;
use Drupal\Core\Field\Entity\BaseFieldOverride;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
use Drupal\node\Entity\Node;
class MigrateNodeBundleSettingsTest extends MigrateDrupal6TestBase {
public function setUp() {
parent::setUp();
$this
->installConfig([
'node',
]);
$this
->executeMigration('d6_node_type');
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',
]);
}
public function testNodeBundleSettings() {
$node = Node::create([
'type' => 'test_page',
]);
$this
->assertIdentical(1, $node->status->value);
$this
->assertIdentical(1, $node->promote->value);
$this
->assertIdentical(1, $node->sticky->value);
$node = Node::create([
'type' => 'test_story',
]);
$this
->assertIdentical(1, $node->status->value);
$this
->assertIdentical(1, $node->promote->value);
$this
->assertIdentical(0, $node->sticky->value);
$node = Node::create([
'type' => 'test_event',
]);
$this
->assertIdentical(0, $node->status->value);
$this
->assertIdentical(0, $node->promote->value);
$this
->assertIdentical(1, $node->sticky->value);
}
}