MigrateNodeBundleSettingsTest.php in Drupal 10        
                          
                  
                        
  
  
  
  
File
  core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeBundleSettingsTest.php
  
    View source  
  <?php
namespace Drupal\Tests\node\Kernel\Migrate\d6;
use Drupal\Core\Field\Entity\BaseFieldOverride;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
use Drupal\node\Entity\Node;
class MigrateNodeBundleSettingsTest extends MigrateDrupal6TestBase {
  
  protected static $modules = [
    'menu_ui',
  ];
  
  protected function setUp() : void {
    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
      ->assertSame(1, $node->status->value);
    $this
      ->assertSame(1, $node->promote->value);
    $this
      ->assertSame(1, $node->sticky->value);
    
    $node = Node::create([
      'type' => 'test_story',
    ]);
    $this
      ->assertSame(1, $node->status->value);
    $this
      ->assertSame(1, $node->promote->value);
    $this
      ->assertSame(0, $node->sticky->value);
    
    $node = Node::create([
      'type' => 'test_event',
    ]);
    $this
      ->assertSame(0, $node->status->value);
    $this
      ->assertSame(0, $node->promote->value);
    $this
      ->assertSame(1, $node->sticky->value);
  }
}