You are here

public function FeedsFileHTTPTestCase::testAbortImportWhenTemporaryFileIsDeleted in Feeds 7.2

Tests that an import is aborted when the temporary file in the in_progress dir is removed.

File

tests/feeds_fetcher_http.test, line 582
Contains FeedsFileHTTPTestCase.

Class

FeedsFileHTTPTestCase
HTTP fetcher test class.

Code

public function testAbortImportWhenTemporaryFileIsDeleted() {
  $source_url = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/many_nodes_ordered.csv';
  $this
    ->setUpMultipleCronRuns($source_url);

  // Run the first cron.
  $this
    ->cronRun();

  // Assert that five nodes have been created.
  $this
    ->assertNodeCount(5);

  // Remove file.
  $file = $this
    ->getInProgressFile();
  drupal_unlink($file->uri);

  // Run cron again and assert that no more nodes are imported.
  $this
    ->cronRun();
  $this
    ->assertNodeCount(5);
}