function FieldTranslationsTestCase::checkTranslationRevisions

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

1 call to FieldTranslationsTestCase::checkTranslationRevisions()
FieldTranslationsTestCase::testFieldFormTranslationRevisions in modules/field/tests/field.test
Tests field translations when creating a new revision.

File

modules/field/tests/field.test, line 3450

Class

FieldTranslationsTestCase
Unit test class for the multilanguage fields logic.

Code

private function checkTranslationRevisions($eid, $evid, $available_languages) {
    $field_name = $this->field['field_name'];
    $entity = field_test_entity_test_load($eid, $evid);
    foreach ($available_languages 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,
        )));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.