public function MigrateCustomBlockContentTranslationTest::testCustomBlockContentTranslation in Drupal 8
Same name in this branch
- 8 core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateCustomBlockContentTranslationTest.php \Drupal\Tests\block_content\Kernel\Migrate\d6\MigrateCustomBlockContentTranslationTest::testCustomBlockContentTranslation()
- 8 core/modules/block_content/tests/src/Kernel/Migrate/d7/MigrateCustomBlockContentTranslationTest.php \Drupal\Tests\block_content\Kernel\Migrate\d7\MigrateCustomBlockContentTranslationTest::testCustomBlockContentTranslation()
Same name and namespace in other branches
- 9 core/modules/block_content/tests/src/Kernel/Migrate/d7/MigrateCustomBlockContentTranslationTest.php \Drupal\Tests\block_content\Kernel\Migrate\d7\MigrateCustomBlockContentTranslationTest::testCustomBlockContentTranslation()
- 10 core/modules/block_content/tests/src/Kernel/Migrate/d7/MigrateCustomBlockContentTranslationTest.php \Drupal\Tests\block_content\Kernel\Migrate\d7\MigrateCustomBlockContentTranslationTest::testCustomBlockContentTranslation()
Tests the Drupal 7 i18n custom block strings to Drupal 8 migration.
File
- core/
modules/ block_content/ tests/ src/ Kernel/ Migrate/ d7/ MigrateCustomBlockContentTranslationTest.php, line 46
Class
- MigrateCustomBlockContentTranslationTest
- Tests migration of i18n custom block strings.
Namespace
Drupal\Tests\block_content\Kernel\Migrate\d7Code
public function testCustomBlockContentTranslation() {
/** @var \Drupal\block_content\Entity\BlockContent $block */
$block = BlockContent::load(1)
->getTranslation('fr');
$this
->assertSame('fr - Mildly amusing limerick of the day', $block
->label());
$this
->assertGreaterThanOrEqual($block
->getChangedTime(), \Drupal::time()
->getRequestTime());
$this
->assertLessThanOrEqual(time(), $block
->getChangedTime());
$this
->assertSame('fr', $block
->language()
->getId());
$translation = "fr - 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($translation, $block->body->value);
$this
->assertSame('filtered_html', $block->body->format);
$block = $block
->getTranslation('is');
$this
->assertSame('is - Mildly amusing limerick of the day', $block
->label());
$this
->assertGreaterThanOrEqual($block
->getChangedTime(), \Drupal::time()
->getRequestTime());
$this
->assertLessThanOrEqual(time(), $block
->getChangedTime());
$this
->assertSame('is', $block
->language()
->getId());
$text = "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($text, $block->body->value);
$this
->assertSame('filtered_html', $block->body->format);
}