protected function NodeTranslationUITest::assertAuthoringInfo

Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::assertAuthoringInfo().

Overrides EntityTranslationUITest::assertAuthoringInfo

File

drupal/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php, line 113
Definition of Drupal\node\Tests\NodeTranslationUITest.

Class

NodeTranslationUITest
Tests the Node Translation UI.

Namespace

Drupal\node\Tests

Code

protected function assertAuthoringInfo() {
  $entity = entity_load($this->entityType, $this->entityId, TRUE);
  $path = $this->controller
    ->getEditPath($entity);
  $languages = language_list();
  $values = array();

  // Post different authoring information for each translation.
  foreach ($this->langcodes as $index => $langcode) {
    $user = $this
      ->drupalCreateUser();
    $values[$langcode] = array(
      'uid' => $user->uid,
      'created' => REQUEST_TIME - mt_rand(0, 1000),
    );
    $edit = array(
      'name' => $user->name,
      'date[date]' => format_date($values[$langcode]['created'], 'custom', 'Y-m-d'),
      'date[time]' => format_date($values[$langcode]['created'], 'custom', 'H:i:s'),
    );
    $this
      ->drupalPost($path, $edit, $this
      ->getFormSubmitAction($entity), array(
      'language' => $languages[$langcode],
    ));
  }
  $entity = entity_load($this->entityType, $this->entityId, TRUE);
  foreach ($this->langcodes as $langcode) {
    $this
      ->assertEqual($entity->translation[$langcode]['uid'] == $values[$langcode]['uid'], 'Translation author correctly stored.');
    $this
      ->assertEqual($entity->translation[$langcode]['created'] == $values[$langcode]['created'], 'Translation date correctly stored.');
  }
}