You are here

public function FeedsMapperMultilingualFieldsTestCase::testWithUninstalledEntityTranslationModule in Feeds 7.2

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

See also

testWithDisabledEntityTranslationModule()

File

tests/feeds_mapper_multilingual_fields.test, line 465
Contains FeedsMapperMultilingualFieldsTestCase.

Class

FeedsMapperMultilingualFieldsTestCase
Tests field mapping with multiple languages.

Code

public function testWithUninstalledEntityTranslationModule() {
  module_disable(array(
    'entity_translation',
  ));
  drupal_uninstall_modules(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'],
    )));
  }
}