From 543a96227012a22b683c1d957afa24cab8cfe7a6 Mon Sep 17 00:00:00 2001
From: Camilla Krag Jensen <camillakrag@gmail.com>
Date: Thu, 3 Mar 2011 21:51:59 -0600
Subject: [PATCH 1/2] Issue #901724: Uploaded logos got the wrong path.

---
 modules/system/system.admin.inc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index fb0664a..c8eb512 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -465,7 +465,7 @@ function system_theme_settings($form, &$form_state, $key = '') {
     // If $logo_path is a public:// URI, display the path relative to the files
     // directory; stream wrappers are not end-user friendly.
     if (file_uri_scheme($logo_path) == 'public') {
-      $logo_path = file_uri_target($logo_path);
+      $logo_path = variable_get('file_public_path', conf_path() . '/files') . '/' . file_uri_target($logo_path);
     }
     $form['logo']['settings']['logo_path'] = array(
       '#type' => 'textfield',
-- 
1.7.0


From dd070afe2ec151ec425e8628d4e24a8b5ab19ee1 Mon Sep 17 00:00:00 2001
From: Camilla Krag Jensen <camillakrag@gmail.com>
Date: Thu, 3 Mar 2011 22:01:19 -0600
Subject: [PATCH 2/2] Issue #901724: Added a test for upload of a logo on the theme
 configuration page.

---
 modules/simpletest/tests/theme.test |   39 +++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test
index d0ad77d..520fe97 100644
--- a/modules/simpletest/tests/theme.test
+++ b/modules/simpletest/tests/theme.test
@@ -349,3 +349,42 @@ class ThemeFastTestCase extends DrupalWebTestCase {
     $this->assertText('registry not initialized', t('The registry was not initialized'));
   }
 }
+
+/**
+ * Tests the configuration options of themes.
+ */
+class ThemeConfigTest extends DrupalWebTestCase {
+  protected $admin_user;
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Theme configuration',
+      'description' => 'Test the configuration options of themes.',
+      'group' => 'Theme',
+    );
+  }
+
+  function setUp() {
+    parent::setUp();
+    $this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer themes'));
+    $this->drupalLogin($this->admin_user);
+  }
+
+/**
+ * Tests that the user can upload a logo and that it is displayed correctly.
+ */
+  function testUploadLogo() {
+   $logo = current($this->drupalGetTestFiles('image'));
+   $edit = array('files[logo_upload]' => drupal_realpath($logo->uri));
+   $this->drupalPost('admin/appearance/settings', $edit, t('Save configuration'));
+   // Grab the uploaded filename.
+   $filename = (string) current($this->xpath('//*[@id="edit-logo-path"]/@value'));
+
+   $this->drupalGet('<front>');
+   // Check that the logo is displayed right.
+   $logo_path = url($filename, array('absolute' => TRUE));
+   $this->assertFieldByXPath('//a[@id="logo"]/img/@src', $logo_path, t('Logo path was correct.'));
+   // Also check that the uploaded logo file actually exists.
+   $this->assertTrue(file_exists($filename), t('Uploaded logo file found.'));
+  }
+}
-- 
1.7.0

