Skip to content
Snippets Groups Projects
feeds_mapper_locale.test 3.19 KiB
<?php
// $Id$

/**
 * @file
 * Test case for locale (language) mapper mappers/locale.inc.
 */

require_once(drupal_get_path('module', 'feeds') . '/tests/feeds_mapper_test.inc');

/**
 * Class for testing Feeds <em>locale</em> mapper.
 */
class FeedsMapperLocaleTestCase extends FeedsMapperTestCase {

  public static function getInfo() {
    return array(
      'name' => t('Mapper: Locale'),
      'description' => t('Test Feeds Mapper support for Locale (Language).'),
      'group' => t('Feeds'),
    );
  }

  /**
   * Set up the test.
   */
  function setUp() {
    // Call parent setup with required modules.
    parent::setUp('feeds', 'feeds_ui', 'ctools', 'job_scheduler', 'locale');

    // Create user and login.
    $this->drupalLogin($this->drupalCreateUser(
        array(
          'administer content types',
          'administer feeds',
          'administer nodes',
          'administer site configuration',
          'administer languages',
        )
    ));

    // Add an additional language and enable it for page and story.
    $edit = array(
      'langcode' => 'zh-hans',
    );
    $this->drupalPost('admin/settings/language/add', $edit, t('Add language'));
    $this->assertText('The language Chinese, Simplified has been created and can now be used.');
    $edit = array(
      'language_content_type' => TRUE,
    );
    foreach (array('story', 'page') as $type) {
      $this->drupalPost("admin/content/node-type/$type", $edit, t('Save content type'));
    }

    // Create an importer configuration with basic mapping.
    $this->createImporterConfiguration('Syndication', 'syndication');
    $this->addMappings('syndication',
      array(
        array(
          'source' => 'title',
          'target' => 'title',
          'unique' => FALSE,
        ),
        array(
          'source' => 'description',
          'target' => 'body',
          'unique' => FALSE,
        ),
        array(
          'source' => 'timestamp',