You are here

function FeedsMapperTaxonomyTestCase::setUp in Feeds 7

Same name and namespace in other branches
  1. 6 tests/feeds_mapper_taxonomy.test \FeedsMapperTaxonomyTestCase::setUp()
  2. 7.2 tests/feeds_mapper_taxonomy.test \FeedsMapperTaxonomyTestCase::setUp()

Set up the test.

Overrides DrupalWebTestCase::setUp

File

tests/feeds_mapper_taxonomy.test, line 26

Class

FeedsMapperTaxonomyTestCase
Class for testing Feeds <em>content</em> mapper.

Code

function setUp() {

  // Call parent setup with required modules.
  parent::setUp('feeds', 'feeds_ui', 'ctools', 'job_scheduler', 'taxonomy');

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

  // Add a new taxonomy vocabulary, add to article content type.
  $edit = array(
    'name' => 'Tags',
    'tags' => TRUE,
    'nodes[article]' => TRUE,
    'nodes[page]' => TRUE,
  );
  $this
    ->drupalPost('admin/content/taxonomy/add/vocabulary', $edit, 'Save');

  // 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',
      'target' => 'created',
      'unique' => FALSE,
    ),
    array(
      'source' => 'url',
      'target' => 'url',
      'unique' => TRUE,
    ),
    array(
      'source' => 'guid',
      'target' => 'guid',
      'unique' => TRUE,
    ),
  ));
}