function FeedsMapperLocaleTestCase::testInheritLanguage in Feeds 6
Same name and namespace in other branches
- 7 tests/feeds_mapper_locale.test \FeedsMapperLocaleTestCase::testInheritLanguage()
Test inheriting language from the feed node.
File
- tests/
feeds_mapper_locale.test, line 73 - Test case for locale (language) mapper mappers/locale.inc.
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/build/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_result(db_query("SELECT COUNT(*) FROM {node} WHERE language = 'zh-hans'"));
$this
->assertEqual(11, $count, 'Found correct number of nodes.');
// Weird simpletest bug language_list() is called on the testbot but locale
// is not installed. Don't care enough to try and fix it. Does not happen on
// Drupal >= 7.
variable_set('language_count', 1);
}