You are here

protected function FeedsFileHTTPTestCase::setUpMultipleCronRuns in Feeds 7.2

Configures the evironment so that multiple cron runs are needed to complete an import.

Parameters

string $source_url: The URL of the file to import.

2 calls to FeedsFileHTTPTestCase::setUpMultipleCronRuns()
FeedsFileHTTPTestCase::testAbortImportWhenTemporaryFileIsDeleted in tests/feeds_fetcher_http.test
Tests that an import is aborted when the temporary file in the in_progress dir is removed.
FeedsFileHTTPTestCase::testImportSourceWithMultipleCronRuns in tests/feeds_fetcher_http.test
Tests importing source that needs multiple cron runs.

File

tests/feeds_fetcher_http.test, line 72
Contains FeedsFileHTTPTestCase.

Class

FeedsFileHTTPTestCase
HTTP fetcher test class.

Code

protected function setUpMultipleCronRuns($source_url) {

  // Process 5 items per batch.
  variable_set('feeds_process_limit', 5);

  // Set variable to enforce that only five items get imported per cron run.
  // @see feeds_tests_cron_queue_alter()
  // @see feeds_tests_feeds_after_save()
  variable_set('feeds_tests_feeds_source_import_queue_time', 5);
  variable_set('feeds_tests_feeds_after_save_sleep', 1);

  // Set up importer.
  $this
    ->setUpImporter();

  // Only import during cron runs, not immediately.
  $this
    ->setSettings('node', NULL, array(
    'import_on_create' => FALSE,
  ));

  // Set source file to import.
  $edit = array(
    'feeds[FeedsHTTPFetcher][source]' => $source_url,
  );
  $this
    ->drupalPost('import/node', $edit, t('Schedule import'));

  // Ensure that no nodes have been created yet.
  $this
    ->assertNodeCount(0, 'No nodes have been created yet (actual: @count).');
}