Skip to content
Snippets Groups Projects
Commit d66f3130 authored by Chris Leppanen's avatar Chris Leppanen
Browse files

Issue #1305698 by dman: Additional validation when creating terms - assert the Vocabulary is valid.

parent 8407bd06
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
class FeedsCSVtoTermsTest extends FeedsWebTestCase { class FeedsCSVtoTermsTest extends FeedsWebTestCase {
public static function getInfo() { public static function getInfo() {
return array( return array(
'name' => 'CSV import to taxonomy', 'name' => 'Processor: Taxonomy',
'description' => 'Tests a standalone import configuration that uses file fetcher and CSV parser to import taxonomy terms from a CSV file.', 'description' => 'Tests a standalone import configuration that uses file fetcher and CSV parser to import taxonomy terms from a CSV file.',
'group' => 'Feeds', 'group' => 'Feeds',
); );
...@@ -92,4 +92,32 @@ class FeedsCSVtoTermsTest extends FeedsWebTestCase { ...@@ -92,4 +92,32 @@ class FeedsCSVtoTermsTest extends FeedsWebTestCase {
$this->assertNoText('Gomez'); $this->assertNoText('Gomez');
$this->assertNoText('Pugsley'); $this->assertNoText('Pugsley');
} }
/**
* Test that saving an invalid vocabulary throws an exception.
*/
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.'));
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment