Same name in other branches
- 2.x tests/src/Functional/EntityCloneLanguageTest.php \Drupal\Tests\entity_clone\Functional\EntityCloneLanguageTest::testLanguageEntityClone()
Test language entity clone.
File
-
tests/
src/ Functional/ EntityCloneLanguageTest.php, line 62
Class
- EntityCloneLanguageTest
- Create an language and test a clone.
Namespace
Drupal\Tests\entity_clone\FunctionalCode
public function testLanguageEntityClone() {
$edit = [
'predefined_langcode' => 'fr',
];
$this->drupalGet("/admin/config/regional/language/add");
$this->submitForm($edit, $this->t('Add language'));
$languages = \Drupal::entityTypeManager()->getStorage('configurable_language')
->loadByProperties([
'id' => 'fr',
]);
$language = reset($languages);
$edit = [
'id' => 'test_language_cloned',
'label' => 'French language cloned',
];
$this->drupalGet('entity_clone/configurable_language/' . $language->id());
$this->submitForm($edit, $this->t('Clone'));
$languages = \Drupal::entityTypeManager()->getStorage('configurable_language')
->loadByProperties([
'id' => $edit['id'],
]);
$language = reset($languages);
$this->assertInstanceOf(ConfigurableLanguage::class, $language, 'Test language cloned found in database.');
}