You are here

private function TranslationWebTest::checkTranslationRevisions in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/field/src/Tests/TranslationWebTest.php \Drupal\field\Tests\TranslationWebTest::checkTranslationRevisions()

Check if the field translation attached to the entity revision identified by the passed arguments were correctly stored.

1 call to TranslationWebTest::checkTranslationRevisions()
TranslationWebTest::testFieldFormTranslationRevisions in core/modules/field/src/Tests/TranslationWebTest.php
Tests field translations when creating a new revision.

File

core/modules/field/src/Tests/TranslationWebTest.php, line 128
Contains \Drupal\field\Tests\TranslationWebTest.

Class

TranslationWebTest
Tests multilanguage fields logic that require a full environment.

Namespace

Drupal\field\Tests

Code

private function checkTranslationRevisions($id, $revision_id, $available_langcodes) {
  $field_name = $this->fieldStorage
    ->getName();
  $entity = entity_revision_load($this->entityTypeId, $revision_id);
  foreach ($available_langcodes as $langcode => $value) {
    $passed = $entity
      ->getTranslation($langcode)->{$field_name}->value == $value + 1;
    $this
      ->assertTrue($passed, format_string('The @language translation for revision @revision was correctly stored', array(
      '@language' => $langcode,
      '@revision' => $entity
        ->getRevisionId(),
    )));
  }
}