From 8937be3679fe12f8d6fbf7e5ee8421e4876e33b4 Mon Sep 17 00:00:00 2001
From: Alex Barth <alex_b@53995.no-reply.drupal.org>
Date: Tue, 5 Oct 2010 23:00:55 +0000
Subject: [PATCH] Fix OPML tests.

---
 feeds_news/feeds_news.test     |  2 +-
 plugins/FeedsNodeProcessor.inc |  2 +-
 tests/feeds.test.inc           | 17 ++++++++---------
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/feeds_news/feeds_news.test b/feeds_news/feeds_news.test
index d7e90955..6e949d8f 100644
--- a/feeds_news/feeds_news.test
+++ b/feeds_news/feeds_news.test
@@ -115,7 +115,7 @@ class FeedsExamplesOPMLTestCase extends FeedsWebTestCase {
     // Import OPML and assert.
     $file = $this->generateOPML();
     $this->importFile('opml', $file);
-    $this->assertText('Created 3 feed nodes.');
+    $this->assertText('Created 3 Feed nodes.');
     $count = db_query("SELECT COUNT(*) FROM {feeds_source}")->fetchField();
     $this->assertEqual($count, 4, 'Found correct number of items.');
 
diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc
index 13679736..87a1346a 100644
--- a/plugins/FeedsNodeProcessor.inc
+++ b/plugins/FeedsNodeProcessor.inc
@@ -357,7 +357,7 @@ class FeedsNodeProcessor extends FeedsProcessor {
           $nid = db_query("SELECT nid FROM {node} WHERE nid = :nid", array(':nid' => $value))->fetchField();
           break;
         case 'feeds_source':
-          if ($id = feeds_get_importer_id($this->importer->config['content_type'])) {
+          if ($id = feeds_get_importer_id($this->config['content_type'])) {
             $nid = db_query("SELECT fs.feed_nid FROM {node} n JOIN {feeds_source} fs ON n.nid = fs.feed_nid WHERE fs.id = :id AND fs.source = :source", array(':id' => $id, ':source' => $value))->fetchField();
           }
           break;
diff --git a/tests/feeds.test.inc b/tests/feeds.test.inc
index aeda416e..dc6e6276 100644
--- a/tests/feeds.test.inc
+++ b/tests/feeds.test.inc
@@ -130,20 +130,19 @@ class FeedsWebTestCase extends DrupalWebTestCase {
 </head>
 <body>
   <outline text="Feeds test group" >
-       <outline title="Development Seed - Technological Solutions for Progressive Organizations" text="" xmlUrl="'. $path .'developmentseed.rss2" type="rss" />
-       <outline title="Magyar Nemzet Online - H’rek" text="" xmlUrl="'. $path .'feed_without_guid.rss2" type="rss" />
-       <outline title="Drupal planet" text="" type="rss" xmlUrl="'. $path .'drupalplanet.rss2" />
-    </outline>
+    <outline title="Development Seed - Technological Solutions for Progressive Organizations" text="" xmlUrl="'. $path .'developmentseed.rss2" type="rss" />
+    <outline title="Magyar Nemzet Online - H’rek" text="" xmlUrl="'. $path .'feed_without_guid.rss2" type="rss" />
+    <outline title="Drupal planet" text="" type="rss" xmlUrl="'. $path .'drupalplanet.rss2" />
+  </outline>
 </body>
 </opml>';
 
     // UTF 8 encode output string and write it to disk
     $output = utf8_encode($output);
-    $file = $this->absolute() .'/'. file_directory_path() .'/test-opml-'. $this->randomName() .'.opml';
-    $handle = fopen($file, 'w');
-    fwrite($handle, $output);
-    fclose($handle);
-    return $file;
+    $filename = file_default_scheme() . '://test-opml-'. $this->randomName() . '.opml';
+
+    $filename = file_unmanaged_save_data($output, $filename);
+    return $filename;
   }
 
   /**
-- 
GitLab