3 namespace Drupal\Tests\block_content\Kernel\Migrate\d6;
5 use Drupal\block_content\Entity\BlockContent;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
9 * Upgrade custom blocks.
11 * @group migrate_drupal_6
13 class MigrateBlockContentTest extends MigrateDrupal6TestBase {
18 public static $modules = ['block', 'block_content'];
23 protected function setUp() {
25 $this->installConfig(['block_content']);
26 $this->installEntitySchema('block_content');
28 $this->executeMigrations([
31 'block_content_body_field',
37 * Tests the Drupal 6 custom block to Drupal 8 migration.
39 public function testBlockMigration() {
40 /** @var BlockContent $block */
41 $block = BlockContent::load(1);
42 $this->assertIdentical('My block 1', $block->label());
43 $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
44 $this->assertIdentical('en', $block->language()->getId());
45 $this->assertIdentical('<h3>My first custom block body</h3>', $block->body->value);
46 $this->assertIdentical('full_html', $block->body->format);
48 $block = BlockContent::load(2);
49 $this->assertIdentical('My block 2', $block->label());
50 $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
51 $this->assertIdentical('en', $block->language()->getId());
52 $this->assertIdentical('<h3>My second custom block body</h3>', $block->body->value);
53 $this->assertIdentical('full_html', $block->body->format);