You are here

public function MigrateBlockContentTest::testBlockMigration in Zircon Profile 8.0

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

Tests the Drupal 6 custom block to Drupal 8 migration.

File

core/modules/block_content/src/Tests/Migrate/d6/MigrateBlockContentTest.php, line 44
Contains \Drupal\block_content\Tests\Migrate\d6\MigrateBlockContentTest.

Class

MigrateBlockContentTest
Upgrade custom blocks.

Namespace

Drupal\block_content\Tests\Migrate\d6

Code

public function testBlockMigration() {

  /** @var BlockContent $block */
  $block = BlockContent::load(1);
  $this
    ->assertIdentical('My block 1', $block
    ->label());
  $this
    ->assertTrue(REQUEST_TIME <= $block
    ->getChangedTime() && $block
    ->getChangedTime() <= time());
  $this
    ->assertIdentical('en', $block
    ->language()
    ->getId());
  $this
    ->assertIdentical('<h3>My first custom block body</h3>', $block->body->value);
  $this
    ->assertIdentical('full_html', $block->body->format);
  $block = BlockContent::load(2);
  $this
    ->assertIdentical('My block 2', $block
    ->label());
  $this
    ->assertTrue(REQUEST_TIME <= $block
    ->getChangedTime() && $block
    ->getChangedTime() <= time());
  $this
    ->assertIdentical('en', $block
    ->language()
    ->getId());
  $this
    ->assertIdentical('<h3>My second custom block body</h3>', $block->body->value);
  $this
    ->assertIdentical('full_html', $block->body->format);
}