You are here

function FeedsMapperLocaleTestCase::testInheritLanguage in Feeds 7

Same name and namespace in other branches
  1. 6 tests/feeds_mapper_locale.test \FeedsMapperLocaleTestCase::testInheritLanguage()

Test inheriting language from the feed node.

File

tests/feeds_mapper_locale.test, line 90

Class

FeedsMapperLocaleTestCase
Class for testing Feeds <em>locale</em> mapper.

Code

function testInheritLanguage() {

  // Map feed node's language to feed item node's language.
  $this
    ->addMappings('syndication', array(
    array(
      'source' => 'parent:language',
      'target' => 'language',
    ),
  ));

  // Turn off import on create, create feed node, add language, import.
  $edit = array(
    'import_on_create' => FALSE,
  );
  $this
    ->drupalPost('admin/structure/feeds/edit/syndication/settings', $edit, 'Save');
  $this
    ->assertText('Do not import on create');
  $nid = $this
    ->createFeedNode();
  $edit = array(
    'language' => 'zh-hans',
  );
  $this
    ->drupalPost("node/{$nid}/edit", $edit, t('Save'));
  $this
    ->drupalPost('node/' . $nid . '/import', array(), 'Import');
  $count = db_query("SELECT COUNT(*) FROM {node} WHERE language = 'zh-hans'")
    ->fetchField();
  $this
    ->assertEqual(11, $count, 'Found correct number of nodes.');
}