Tests up-to-date status tracking.
protected function assertOutdatedStatus() {
$entity = entity_load($this->entityType, $this->entityId, TRUE);
$langcode = 'fr';
$default_langcode = $this->langcodes[0];
// Mark translations as outdated.
$edit = array(
'translation_entity[retranslate]' => TRUE,
);
$this
->drupalPost($langcode . '/' . $this->controller
->getEditPath($entity), $edit, $this
->getFormSubmitAction($entity));
$entity = entity_load($this->entityType, $this->entityId, TRUE);
// Check that every translation has the correct "outdated" status.
foreach ($this->langcodes as $enabled_langcode) {
$prefix = $enabled_langcode != $default_langcode ? $enabled_langcode . '/' : '';
$path = $prefix . $this->controller
->getEditPath($entity);
$this
->drupalGet($path);
if ($enabled_langcode == $langcode) {
$this
->assertFieldByXPath('//input[@name="translation_entity[retranslate]"]', FALSE, 'The retranslate flag is not checked by default.');
}
else {
$this
->assertFieldByXPath('//input[@name="translation_entity[outdated]"]', TRUE, 'The translate flag is checked by default.');
$edit = array(
'translation_entity[outdated]' => FALSE,
);
$this
->drupalPost($path, $edit, $this
->getFormSubmitAction($entity));
$this
->drupalGet($path);
$this
->assertFieldByXPath('//input[@name="translation_entity[retranslate]"]', FALSE, 'The retranslate flag is now shown.');
$entity = entity_load($this->entityType, $this->entityId, TRUE);
$this
->assertFalse($entity->translation[$enabled_langcode]['outdated'], 'The "outdated" status has been correctly stored.');
}
}
}