$this->
assertEquals($langcode2,
$hooks['entity_translation_create'
], 'The generic entity translation creation hook has fired.'
);
$this->
assertEquals($langcode2,
$hooks[$entity_type . '_translation_create'
], 'The entity-type-specific entity translation creation hook has fired.'
);
$this->
assertEquals($langcode2,
$hooks['entity_translation_insert'
], 'The generic entity translation insertion hook has fired.'
);
$this->
assertEquals($langcode2,
$hooks[$entity_type . '_translation_insert'
], 'The entity-type-specific entity translation insertion hook has fired.'
);
// Verify that trying to manipulate a translation object referring to a
// removed translation results in exceptions being thrown.
$entity =
$this->
reloadEntity($entity);
$translation =
$entity->
getTranslation($langcode2);
$entity->
removeTranslation($langcode2);
foreach (['get', 'set', '__get', '__set', 'createDuplicate'
] as $method) { try { $translation->
{$method}('name',
$this->
randomMachineName());
$this->
fail("The
$method method raises an exception when trying to manipulate a removed translation."
);
} catch (\Exception
$e) { // Expected exception; just continue testing.
} } // Verify that deletion hooks are fired when saving an entity with a removed