You are here

public function FeedsFileFetcherTestCase::testRemoveFileAfterImport in Feeds 7.2

Tests if files can be removed after the import has finished.

File

tests/feeds_fetcher_file.test, line 112
File fetcher tests.

Class

FeedsFileFetcherTestCase
File fetcher test class.

Code

public function testRemoveFileAfterImport() {
  $this
    ->setSettings('node', 'FeedsFileFetcher', array(
    'delete_uploaded_file' => TRUE,
    'directory' => 'private://feeds',
  ));

  // Import the file.
  $this
    ->importFile('node', $this
    ->absolutePath() . '/tests/feeds/content.csv');
  $this
    ->assertText('Created 2 nodes');

  // Assert that the file no longer exists.
  $this
    ->assertFalse(file_exists('private://feeds/content.csv'), 'The imported file no longer exists.');

  // Assert that the file is no longer shown on the import form.
  $this
    ->drupalGet('import/node');
  $this
    ->assertNoText('nodes.csv');
}