function MigrateCustomBlockTest::testCustomBlockMigration

Same name in other branches
  1. 8.9.x core/modules/block_content/tests/src/Kernel/Migrate/d7/MigrateCustomBlockTest.php \Drupal\Tests\block_content\Kernel\Migrate\d7\MigrateCustomBlockTest::testCustomBlockMigration()
  2. 10 core/modules/block_content/tests/src/Kernel/Migrate/d7/MigrateCustomBlockTest.php \Drupal\Tests\block_content\Kernel\Migrate\d7\MigrateCustomBlockTest::testCustomBlockMigration()
  3. 11.x core/modules/block_content/tests/src/Kernel/Migrate/d7/MigrateCustomBlockTest.php \Drupal\Tests\block_content\Kernel\Migrate\d7\MigrateCustomBlockTest::testCustomBlockMigration()

Tests migration of custom blocks from Drupal 7 to Drupal 8.

File

core/modules/block_content/tests/src/Kernel/Migrate/d7/MigrateCustomBlockTest.php, line 41

Class

MigrateCustomBlockTest
Tests migration of custom blocks.

Namespace

Drupal\Tests\block_content\Kernel\Migrate\d7

Code

public function testCustomBlockMigration() {
    $block = BlockContent::load(1);
    $this->assertInstanceOf(BlockContentInterface::class, $block);
    
    /** @var \Drupal\block_content\BlockContentInterface $block */
    $this->assertSame('Limerick', $block->label());
    $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";
    $this->assertSame($expected_body, $block->body->value);
    $this->assertSame('filtered_html', $block->body->format);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.