From ef104d070fe9263e2bf191b4c5d205540d8acbdc Mon Sep 17 00:00:00 2001
From: Chris Leppanen <chris.leppanen@gmail.com>
Date: Sat, 30 May 2015 17:35:51 -0700
Subject: [PATCH] Add test for #2489006.

---
 tests/feeds_mapper_taxonomy.test | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/tests/feeds_mapper_taxonomy.test b/tests/feeds_mapper_taxonomy.test
index 2951b583..4a2eb8ae 100644
--- a/tests/feeds_mapper_taxonomy.test
+++ b/tests/feeds_mapper_taxonomy.test
@@ -17,7 +17,7 @@ class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase {
     );
   }
 
-  function setUp() {
+  public function setUp() {
     parent::setUp();
 
     // Add Tags vocabulary
@@ -114,7 +114,7 @@ class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase {
   /**
    * Tests inheriting taxonomy from the feed node.
    */
-  function testInheritTaxonomy() {
+  public function testInheritTaxonomy() {
 
     // Adjust importer settings
     $this->setSettings('syndication', NULL, array('import_period' => FEEDS_SCHEDULE_NEVER));
@@ -344,6 +344,26 @@ class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase {
     }
   }
 
+  /**
+   * Tests that there are no errors when trying to map to an invalid vocabulary.
+   */
+  public function testMissingVocabulary() {
+    $this->addMappings('syndication', array(
+      5 => array(
+        'source' => 'tags',
+        'target' => 'field_tags',
+        'term_search' => 0,
+        'autocreate' => TRUE,
+      ),
+    ));
+
+    // Create an invalid configuration.
+    db_delete('taxonomy_vocabulary')->execute();
+
+    $this->createFeedNode('syndication', NULL, 'Syndication');
+    $this->assertText('Created 10 nodes.');
+  }
+
   /**
    * Finds node style taxonomy term markup in DOM.
    */
@@ -359,4 +379,5 @@ class FeedsMapperTaxonomyTestCase extends FeedsMapperTestCase {
     $term = check_plain($term);
     $this->assertNoPattern('/<a href="\/.*taxonomy\/term\/[0-9]+">' . $term . '<\/a>/', 'Did not find ' . $term);
   }
+
 }
-- 
GitLab