You are here

public function feedsDrushTest::testNoImportForDisabledImporter in Feeds 7.2

Tests that no nodes get imported for a disabled importer.

File

tests/drush/feedsDrushTest.php, line 124

Class

feedsDrushTest
Tests Drush integration for Feeds. Based on Drush 8.

Namespace

Unish

Code

public function testNoImportForDisabledImporter() {

  // Disable the node importer.
  $this
    ->execDrush('feeds-disable', array(
    'node',
  ));

  // Try to perform an import. Drush command should fail.
  $this
    ->drush('feeds-import', array(
    'node',
  ), $this->siteOptions + array(
    'file' => $this
      ->getFeedsDir() . '/tests/feeds/content.csv',
  ), NULL, NULL, static::EXIT_ERROR);

  // Ensure that no nodes were imported.
  $eval = "print db_query('SELECT COUNT(*) FROM {node}')->fetchField()";
  $this
    ->execDrush('php-eval', array(
    $eval,
  ));
  $this
    ->assertEquals('0', $this
    ->getOutput());
}