You are here

public function FeedsCSVtoUsersTest::setUp in Feeds 7.2

Same name and namespace in other branches
  1. 7 tests/feeds_processor_user.test \FeedsCSVtoUsersTest::setUp()

Sets up a Drupal site for running functional and integration tests.

Generates a random database prefix and installs Drupal with the specified installation profile in DrupalWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Overrides FeedsWebTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

File

tests/feeds_processor_user.test, line 27
Tests for plugins/FeedsUserProcessor.inc.

Class

FeedsCSVtoUsersTest
Test aggregating a feed as data records.

Code

public function setUp() {
  parent::setUp();

  // Include FeedsProcessor.inc to make its constants available.
  module_load_include('inc', 'feeds', 'plugins/FeedsProcessor');

  // Create an importer.
  $this
    ->createImporterConfiguration('User import', 'user_import');

  // Set and configure plugins.
  $this
    ->setPlugin('user_import', 'FeedsFileFetcher');
  $this
    ->setPlugin('user_import', 'FeedsCSVParser');
  $this
    ->setPlugin('user_import', 'FeedsUserProcessor');

  // Go to mapping page and create a couple of mappings.
  $mappings = array(
    0 => array(
      'source' => 'name',
      'target' => 'name',
      'unique' => FALSE,
    ),
    1 => array(
      'source' => 'mail',
      'target' => 'mail',
      'unique' => TRUE,
    ),
    2 => array(
      'source' => 'since',
      'target' => 'created',
    ),
    3 => array(
      'source' => 'password',
      'target' => 'pass',
    ),
  );
  $this
    ->addMappings('user_import', $mappings);

  // Use standalone form.
  $edit = array(
    'content_type' => '',
  );
  $this
    ->drupalPost('admin/structure/feeds/user_import/settings', $edit, 'Save');
}