You are here

public function MigrateBlockContentTest::testBlockMigration in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateBlockContentTest.php \Drupal\Tests\block_content\Kernel\Migrate\d6\MigrateBlockContentTest::testBlockMigration()
  2. 9 core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateBlockContentTest.php \Drupal\Tests\block_content\Kernel\Migrate\d6\MigrateBlockContentTest::testBlockMigration()

Tests the Drupal 6 custom block to Drupal 8 migration.

File

core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateBlockContentTest.php, line 39

Class

MigrateBlockContentTest
Upgrade custom blocks.

Namespace

Drupal\Tests\block_content\Kernel\Migrate\d6

Code

public function testBlockMigration() {

  /** @var \Drupal\block_content\Entity\BlockContent $block */
  $block = BlockContent::load(1);
  $this
    ->assertSame('My block 1', $block
    ->label());
  $this
    ->assertGreaterThanOrEqual(REQUEST_TIME, $block
    ->getChangedTime());
  $this
    ->assertLessThanOrEqual(time(), $block
    ->getChangedTime());
  $this
    ->assertSame('en', $block
    ->language()
    ->getId());
  $this
    ->assertSame('<h3>My first custom block body</h3>', $block->body->value);
  $this
    ->assertSame('full_html', $block->body->format);
  $block = BlockContent::load(2);
  $this
    ->assertSame('My block 2', $block
    ->label());
  $this
    ->assertGreaterThanOrEqual(REQUEST_TIME, $block
    ->getChangedTime());
  $this
    ->assertLessThanOrEqual(time(), $block
    ->getChangedTime());
  $this
    ->assertSame('en', $block
    ->language()
    ->getId());
  $this
    ->assertSame('<h3>My second custom block body</h3>', $block->body->value);
  $this
    ->assertSame('full_html', $block->body->format);
}