From e21af4c25e495f54e9084b0a91a736c0527f2cb7 Mon Sep 17 00:00:00 2001
From: Chris Leppanen <chris.leppanen@gmail.com>
Date: Tue, 18 Dec 2012 18:46:51 -0800
Subject: [PATCH] Issue #1711648 by twistor: Fixes for tests.

---
 tests/feeds_fetcher_file.test   |  5 +----
 tests/feeds_mapper_date.test    |  5 ++---
 tests/feeds_mapper_field.test   |  2 +-
 tests/feeds_mapper_file.test    |  9 +++------
 tests/feeds_mapper_link.test    |  2 +-
 tests/feeds_mapper_path.test    | 14 +++-----------
 tests/feeds_processor_node.test |  6 +++---
 7 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/tests/feeds_fetcher_file.test b/tests/feeds_fetcher_file.test
index 6431698f..18e97890 100644
--- a/tests/feeds_fetcher_file.test
+++ b/tests/feeds_fetcher_file.test
@@ -25,10 +25,7 @@ class FeedsFileFetcherTestCase extends FeedsWebTestCase {
     // Set up an importer.
     $this->createImporterConfiguration('Node import', 'node');
     // Set and configure plugins and mappings.
-    $edit = array(
-      'content_type' => '',
-    );
-    $this->drupalPost('admin/structure/feeds/node/settings', $edit, 'Save');
+    $this->setSettings('node', NULL, array('content_type' => ''));
     $this->setPlugin('node', 'FeedsFileFetcher');
     $this->setPlugin('node', 'FeedsCSVParser');
     $mappings = array(
diff --git a/tests/feeds_mapper_date.test b/tests/feeds_mapper_date.test
index 60fb383c..429bca1c 100644
--- a/tests/feeds_mapper_date.test
+++ b/tests/feeds_mapper_date.test
@@ -43,8 +43,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase {
     $this->createImporterConfiguration('Date RSS', 'daterss');
     $this->setSettings('daterss', NULL, array('content_type' => '', 'import_period' => FEEDS_SCHEDULE_NEVER));
     $this->setPlugin('daterss', 'FeedsFileFetcher');
-    $this->setPlugin('daterss', 'FeedsSyndicationParser');
-    $this->setSettings('daterss', 'FeedsNodeProcessor', array('content_type' => $typename));
+    $this->setSettings('daterss', 'FeedsNodeProcessor', array('bundle' => $typename));
     $this->addMappings('daterss', array(
       0 => array(
         'source' => 'title',
@@ -81,7 +80,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase {
       '01/06/2010 - 06:05',
       '01/06/2010 - 11:26',
       '01/07/2010 - 00:26',
-      );
+    );
     for ($i = 1; $i <= 6; $i++) {
       $this->drupalGet("node/$i/edit");
       $this->assertNodeFieldValue('date', $values[$i-1]);
diff --git a/tests/feeds_mapper_field.test b/tests/feeds_mapper_field.test
index 130d0af3..2506a295 100644
--- a/tests/feeds_mapper_field.test
+++ b/tests/feeds_mapper_field.test
@@ -38,7 +38,7 @@ class FeedsMapperFieldTestCase extends FeedsMapperTestCase {
     $this->setSettings('csv', NULL, array('content_type' => '', 'import_period' => FEEDS_SCHEDULE_NEVER));
     $this->setPlugin('csv', 'FeedsFileFetcher');
     $this->setPlugin('csv', 'FeedsCSVParser');
-    $this->setSettings('csv', 'FeedsNodeProcessor', array('content_type' => $typename));
+    $this->setSettings('csv', 'FeedsNodeProcessor', array('bundle' => $typename));
     $this->addMappings('csv', array(
       0 => array(
         'source' => 'title',
diff --git a/tests/feeds_mapper_file.test b/tests/feeds_mapper_file.test
index 909e47ed..20c79122 100644
--- a/tests/feeds_mapper_file.test
+++ b/tests/feeds_mapper_file.test
@@ -47,7 +47,7 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase {
     // Create importer configuration.
     $this->createImporterConfiguration();
     $this->setPlugin('syndication', 'FeedsSimplePieParser');
-    $this->setSettings('syndication', 'FeedsNodeProcessor', array('content_type' => $typename));
+    $this->setSettings('syndication', 'FeedsNodeProcessor', array('bundle' => $typename));
     $this->addMappings('syndication', array(
       0 => array(
         'source' => 'title',
@@ -90,7 +90,8 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase {
     // Create a CSV importer configuration.
     $this->createImporterConfiguration('Node import from CSV', 'node');
     $this->setPlugin('node', 'FeedsCSVParser');
-    $this->setSettings('node', 'FeedsNodeProcessor', array('content_type' => $typename));
+    $this->setSettings('node', 'FeedsNodeProcessor', array('bundle' => $typename));
+    $this->setSettings('node', NULL, array('content_type' => ''));
     $this->addMappings('node', array(
       0 => array(
         'source' => 'title',
@@ -101,10 +102,6 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase {
         'target' => 'field_files'
       ),
     ));
-    $edit = array(
-      'content_type' => '',
-    );
-    $this->drupalPost('admin/structure/feeds/node/settings', $edit, 'Save');
 
     // Import.
     $edit = array(
diff --git a/tests/feeds_mapper_link.test b/tests/feeds_mapper_link.test
index 5fddbb15..a64fc944 100644
--- a/tests/feeds_mapper_link.test
+++ b/tests/feeds_mapper_link.test
@@ -59,7 +59,7 @@ class FeedsMapperLinkTestCase extends FeedsMapperTestCase {
 
     // Create importer configuration.
     $this->createImporterConfiguration(); //Create a default importer configuration
-    $this->setSettings('syndication', 'FeedsNodeProcessor', array('content_type' => $typename)); //Processor settings
+    $this->setSettings('syndication', 'FeedsNodeProcessor', array('bundle' => $typename)); //Processor settings
     $this->addMappings('syndication', array(
       0 => array(
         'source' => 'title',
diff --git a/tests/feeds_mapper_path.test b/tests/feeds_mapper_path.test
index 55f75b02..bb408dba 100644
--- a/tests/feeds_mapper_path.test
+++ b/tests/feeds_mapper_path.test
@@ -94,10 +94,7 @@ class FeedsMapperPathTestCase extends FeedsMapperTestCase {
     );
     $this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save'));
 
-    $this->setSettings('path_test', 'FeedsTermProcessor', array('vocabulary' => 'addams'));
-    
-    // Turn on update existing.
-    $this->setSettings('path_test', 'FeedsTermProcessor', array('update_existing' => 2));
+    $this->setSettings('path_test', 'FeedsTermProcessor', array('bundle' => 'addams', 'update_existing' => 2));
 
     // Add mappings.
     $this->addMappings('path_test', array(
@@ -208,7 +205,7 @@ class FeedsMapperPathPathautoTestCase extends FeedsMapperTestCase {
     $aliases = array();
 
     for ($i = 1; $i <= 9; $i++) {
-      $aliases[] = "path$i";
+      $aliases[] = "content/pathauto$i";
     }
 
     $this->assertAliasCount($aliases);
@@ -229,12 +226,7 @@ class FeedsMapperPathPathautoTestCase extends FeedsMapperTestCase {
   }
 
   public function assertAliasCount($aliases) {
-    $in_db = db_select('url_alias', 'a')
-      ->fields('a')
-      ->condition('a.alias', $aliases)
-      ->execute()
-      ->fetchAll();
-
+    $in_db = db_query("SELECT * FROM {url_alias} WHERE alias IN (:aliases)", array(':aliases' => $aliases))->fetchAll();
     $this->assertEqual(count($in_db), count($aliases), 'Correct number of aliases in db.');
   }
 }
diff --git a/tests/feeds_processor_node.test b/tests/feeds_processor_node.test
index 677bd95a..a61df781 100644
--- a/tests/feeds_processor_node.test
+++ b/tests/feeds_processor_node.test
@@ -408,13 +408,13 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase {
   }
 
   /**
-   * Test that nodes will not be created if the user is unauthorized to create 
+   * Test that nodes will not be created if the user is unauthorized to create
    * them.
    */
   public function testAuthorize() {
 
-    // Create a user with limited permissions. We can't use 
-    // $this->drupalCreateUser here because we need to to set a specific user 
+    // Create a user with limited permissions. We can't use
+    // $this->drupalCreateUser here because we need to to set a specific user
     // name.
     $edit = array(
       'name' => 'Development Seed',
-- 
GitLab