You are here

public function FeedsCSVtoTermsTest::testInvalidVocabulary in Feeds 7.2

Test that saving an invalid vocabulary throws an exception.

File

tests/feeds_processor_term.test, line 103
Tests for plugins/FeedsTermProcessor.inc.

Class

FeedsCSVtoTermsTest
Test aggregating a feed as data records.

Code

public function testInvalidVocabulary() {
  $mappings = array(
    0 => array(
      'source' => 'name',
      'target' => 'name',
      'unique' => 1,
    ),
  );
  $this
    ->addMappings('term_import', $mappings);

  // Force configuration to be invalid.
  $config = unserialize(db_query("SELECT config FROM {feeds_importer} WHERE id = :id", array(
    ':id' => 'term_import',
  ))
    ->fetchField());
  $config['processor']['config']['bundle'] = 'does_not_exist';
  db_update('feeds_importer')
    ->fields(array(
    'config' => serialize($config),
  ))
    ->condition('id', 'term_import')
    ->execute();

  // Import and assert.
  $this
    ->importFile('term_import', $this
    ->absolutePath() . '/tests/feeds/users.csv');
  $this
    ->assertText(t('No vocabulary defined for Taxonomy Term processor.'));
}