You are here

public function FeedsMapperMultilingualFieldsTestCase::testWithDisabledEntityTranslationModule in Feeds 7.2

Tests if fields still are imported in their language when the entity_translation module gets disabled.

The entity_translation module is mainly an UI module for configuring field language and disabling that module should not have effect on importing values in a specific language for fields.

File

tests/feeds_mapper_multilingual_fields.test, line 430
Contains FeedsMapperMultilingualFieldsTestCase.

Class

FeedsMapperMultilingualFieldsTestCase
Tests field mapping with multiple languages.

Code

public function testWithDisabledEntityTranslationModule() {
  module_disable(array(
    'entity_translation',
  ));

  // Make sure that entity info is reset.
  drupal_flush_all_caches();
  drupal_static_reset();

  // Configure importer to import in French language.
  $this
    ->setSettings('node', 'FeedsNodeProcessor', array(
    'language' => 'fr',
  ));
  $this
    ->addMappings('node', $this
    ->getMappingsInLanguage('fr'));

  // Import content.
  $this
    ->importFile('node', $this
    ->absolutePath() . '/tests/feeds/multilingual_fr.csv');
  $this
    ->assertText(t('Created 1 node'));

  // Assert that the fields were all created in French.
  $node = node_load(1, NULL, TRUE);
  $french = $this
    ->getFrenchValues($node) + array(
    'field_category' => array(
      'expected' => 1,
      'actual' => $node->field_category['fr'][0]['tid'],
    ),
  );
  foreach ($french as $field_name => $value) {
    $this
      ->assertEqual($value['expected'], $value['actual'], format_string('The field %field has the expected value (actual: @actual).', array(
      '%field' => $field_name,
      '@actual' => $value['actual'],
    )));
  }
}