You are here

protected function FeedsFileHTTPTestCase::getInProgressFile in Feeds 7.2

Returns the file in the Feeds in_progress directory.

Return value

object The found file.

Throws

Exception In case no file was found, so the test can abort without issuing a fatal error.

2 calls to FeedsFileHTTPTestCase::getInProgressFile()
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 109
Contains FeedsFileHTTPTestCase.

Class

FeedsFileHTTPTestCase
HTTP fetcher test class.

Code

protected function getInProgressFile() {

  // Assert that a file exists in the in_progress dir.
  $files = file_scan_directory('private://feeds/in_progress', '/.*/');
  debug($files);
  $this
    ->assertEqual(1, count($files), 'The feeds "in progress" dir contains one file.');
  if (!count($files)) {

    // Abort test.
    throw new Exception('File not found.');
  }
  return reset($files);
}