function MigrateBlockContentTest::testBlockMigration
Same name in other branches
- 9 core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateBlockContentTest.php \Drupal\Tests\block_content\Kernel\Migrate\d6\MigrateBlockContentTest::testBlockMigration()
- 8.9.x core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateBlockContentTest.php \Drupal\Tests\block_content\Kernel\Migrate\d6\MigrateBlockContentTest::testBlockMigration()
- 10 core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateBlockContentTest.php \Drupal\Tests\block_content\Kernel\Migrate\d6\MigrateBlockContentTest::testBlockMigration()
Tests the Drupal 6 content block to Drupal 8 migration.
File
-
core/
modules/ block_content/ tests/ src/ Kernel/ Migrate/ d6/ MigrateBlockContentTest.php, line 41
Class
- MigrateBlockContentTest
- Upgrade content blocks.
Namespace
Drupal\Tests\block_content\Kernel\Migrate\d6Code
public function testBlockMigration() : void {
/** @var \Drupal\block_content\Entity\BlockContent $block */
$block = BlockContent::load(1);
$this->assertSame('My block 1', $block->label());
$requestTime = \Drupal::time()->getRequestTime();
$this->assertGreaterThanOrEqual($requestTime, (int) $block->getChangedTime());
$this->assertLessThanOrEqual(time(), $block->getChangedTime());
$this->assertSame('en', $block->language()
->getId());
$this->assertSame('<h3>My first content 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($requestTime, (int) $block->getChangedTime());
$this->assertGreaterThanOrEqual($requestTime, (int) $block->getChangedTime());
$this->assertLessThanOrEqual(time(), $block->getChangedTime());
$this->assertSame('en', $block->language()
->getId());
$this->assertSame('<h3>My second content block body</h3>', $block->body->value);
$this->assertSame('full_html', $block->body->format);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.