Creates a test entity and translate it.
protected function setupEntity() {
$default_langcode = $this->langcodes[0];
// Create a test entity.
$values = array(
'name' => $this
->randomName(),
'user_id' => mt_rand(1, 128),
$this->fieldName => array(
array(
'value' => $this
->randomName(16),
),
),
);
$id = $this
->createEntity($values, $default_langcode);
$this->entity = entity_load($this->entityType, $id, TRUE);
// Create a translation.
$this
->drupalLogin($this->translator);
$add_translation_path = $this->controller
->getBasePath($this->entity) . "/translations/add/{$default_langcode}/{$this->langcodes[2]}";
$this
->drupalPost($add_translation_path, array(), t('Save'));
$this
->rebuildContainer();
}