function BlockContentTranslationUITest::doTestBasicTranslation
Same name in other branches
- 9 core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php \Drupal\Tests\block_content\Functional\BlockContentTranslationUITest::doTestBasicTranslation()
- 8.9.x core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php \Drupal\Tests\block_content\Functional\BlockContentTranslationUITest::doTestBasicTranslation()
- 11.x core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php \Drupal\Tests\block_content\Functional\BlockContentTranslationUITest::doTestBasicTranslation()
Overrides ContentTranslationUITestBase::doTestBasicTranslation
File
-
core/
modules/ block_content/ tests/ src/ Functional/ BlockContentTranslationUITest.php, line 112
Class
- BlockContentTranslationUITest
- Tests the block content translation UI.
Namespace
Drupal\Tests\block_content\FunctionalCode
protected function doTestBasicTranslation() {
parent::doTestBasicTranslation();
// Ensure that a block translation can be created using the same description
// as in the original language.
$default_langcode = $this->langcodes[0];
$values = $this->getNewEntityValues($default_langcode);
$storage = \Drupal::entityTypeManager()->getStorage($this->entityTypeId);
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = $storage->create([
'type' => 'basic',
] + $values);
$entity->save();
$entity->addTranslation('it', $values);
try {
$entity->save();
} catch (\Exception $e) {
$this->fail('Blocks can have translations with the same "info" value.');
}
// Check that the translate operation link is shown.
$this->drupalGet('admin/content/block');
$this->assertSession()
->linkByHrefExists('admin/content/block/' . $entity->id() . '/translations');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.