private function TranslationTest::checkTranslationRevisions

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

1 call to TranslationTest::checkTranslationRevisions()
TranslationTest::testFieldFormTranslationRevisions in drupal/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php
Tests field translations when creating a new revision.

File

drupal/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php, line 376
Definition of Drupal\field\Tests\TranslationTest.

Class

TranslationTest
Unit test class for the multilanguage fields logic.

Namespace

Drupal\field\Tests

Code

private function checkTranslationRevisions($eid, $evid, $available_langcodes) {
  $field_name = $this->field['field_name'];
  $entity = field_test_entity_test_load($eid, $evid);
  foreach ($available_langcodes as $langcode => $value) {
    $passed = isset($entity->{$field_name}[$langcode]) && $entity->{$field_name}[$langcode][0]['value'] == $value + 1;
    $this
      ->assertTrue($passed, format_string('The @language translation for revision @revision was correctly stored', array(
      '@language' => $langcode,
      '@revision' => $entity->ftvid,
    )));
  }
}