3 namespace Drupal\Tests\block_content\Kernel\Migrate\d7;
5 use Drupal\block_content\BlockContentInterface;
6 use Drupal\block_content\Entity\BlockContent;
7 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
10 * Tests migration of custom blocks.
12 * @group block_content
14 class MigrateCustomBlockTest extends MigrateDrupal7TestBase {
16 public static $modules = [
25 protected function setUp() {
27 $this->installConfig(static::$modules);
28 $this->installEntitySchema('block_content');
30 $this->executeMigrations([
33 'block_content_body_field',
39 * Tests migration of custom blocks from Drupal 7 to Drupal 8.
41 public function testCustomBlockMigration() {
42 $block = BlockContent::load(1);
43 $this->assertTrue($block instanceof BlockContentInterface);
44 /** @var \Drupal\block_content\BlockContentInterface $block */
45 $this->assertIdentical('Limerick', $block->label());
47 $expected_body = "A fellow jumped off a high wall\r\nAnd had a most terrible fall\r\nHe went back to bed\r\nWith a bump on his head\r\nThat's why you don't jump off a wall";
48 $this->assertIdentical($expected_body, $block->body->value);
49 $this->assertIdentical('filtered_html', $block->body->format);