protected function ContentTranslationWorkflowsTest::setupEntity in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php \Drupal\content_translation\Tests\ContentTranslationWorkflowsTest::setupEntity()
Creates a test entity and translate it.
1 call to ContentTranslationWorkflowsTest::setupEntity()
- ContentTranslationWorkflowsTest::setUp in core/
modules/ content_translation/ src/ Tests/ ContentTranslationWorkflowsTest.php - Sets up a Drupal site for running functional and integration tests.
File
- core/
modules/ content_translation/ src/ Tests/ ContentTranslationWorkflowsTest.php, line 61 - Contains \Drupal\content_translation\Tests\ContentTranslationWorkflowsTest.
Class
- ContentTranslationWorkflowsTest
- Tests the content translation workflows for the test entity.
Namespace
Drupal\content_translation\TestsCode
protected function setupEntity() {
$default_langcode = $this->langcodes[0];
// Create a test entity.
$user = $this
->drupalCreateUser();
$values = array(
'name' => $this
->randomMachineName(),
'user_id' => $user
->id(),
$this->fieldName => array(
array(
'value' => $this
->randomMachineName(16),
),
),
);
$id = $this
->createEntity($values, $default_langcode);
$this->entity = entity_load($this->entityTypeId, $id, TRUE);
// Create a translation.
$this
->drupalLogin($this->translator);
$add_translation_url = Url::fromRoute("entity.{$this->entityTypeId}.content_translation_add", [
$this->entityTypeId => $this->entity
->id(),
'source' => $default_langcode,
'target' => $this->langcodes[2],
]);
$this
->drupalPostForm($add_translation_url, array(), t('Save'));
$this
->rebuildContainer();
}