You are here

public function FeedsRulesTest::testFeedsImportActionUsingStandaloneForm in Feeds 7.2

Tests the Rules action 'feeds_import_feed' with standalone form.

File

tests/feeds_rules.test, line 230
Contains FeedsRulesTest.

Class

FeedsRulesTest
Tests for Rules integration.

Code

public function testFeedsImportActionUsingStandaloneForm() {
  $this
    ->setSettings('node', NULL, array(
    'import_period' => FEEDS_SCHEDULE_NEVER,
    'import_on_create' => FALSE,
  ));

  // Save data on import form.
  $edit = array(
    'feeds[FeedsHTTPFetcher][source]' => $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/content.csv',
  );
  $this
    ->drupalPost('import/node', $edit, 'Save');

  // Create rule with import action.
  $rule = $this
    ->createTestRule('cron', FALSE);
  $rule
    ->action('feeds_import_feed', array(
    'importer' => 'node',
    'feed_nid' => 0,
  ));
  $rule
    ->integrityCheck()
    ->save();

  // Trigger rules event.
  $this
    ->cronRun();

  // Assert that 2 items have been imported.
  $this
    ->assertNodeCount(2);
}