$this->
assertSession()->
statusCodeEquals(403
);
} /**
* Tests that translations are rendered properly.
*/
public function testTranslationRendering() { $default_langcode =
$this->langcodes
[0
];
$values[$default_langcode] =
$this->
getNewEntityValues($default_langcode);
$this->entityId =
$this->
createEntity($values[$default_langcode],
$default_langcode);
$node = \Drupal::
entityTypeManager()->
getStorage($this->entityTypeId
)->
load($this->entityId
);
$node->
setPromoted(TRUE
);
// Create translations.
foreach (array_diff($this->langcodes,
[$default_langcode]) as $langcode) { $values[$langcode] =
$this->
getNewEntityValues($langcode);
$translation =
$node->
addTranslation($langcode,
$values[$langcode]);
// Publish and promote the translation to frontpage.
$translation->
setPromoted(TRUE
);
$translation->
setPublished();
} $node->
save();