From 79c607df956613a18b2b90f59a002982c695a1c5 Mon Sep 17 00:00:00 2001 From: ayushchd Date: Fri, 5 Apr 2013 14:25:29 +0530 Subject: [PATCH 1/2] Fixed webOS detection for Darwin --- libraries/Config.class.php | 2 +- test/classes/PMA_Config_test.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 37d54aff4d..91338f1a69 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -313,7 +313,7 @@ class PMA_Config $this->set('PMA_IS_WINDOWS', 0); // If PHP_OS is defined then continue if (defined('PHP_OS')) { - if (stristr(PHP_OS, 'win')) { + if (stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin')) { // Is it some version of Windows $this->set('PMA_IS_WINDOWS', 1); } elseif (stristr(PHP_OS, 'OS/2')) { diff --git a/test/classes/PMA_Config_test.php b/test/classes/PMA_Config_test.php index 8be6507584..b4fa6b5b28 100644 --- a/test/classes/PMA_Config_test.php +++ b/test/classes/PMA_Config_test.php @@ -269,7 +269,9 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase $this->object->checkWebServerOs(); if (defined('PHP_OS')) { - if (stristr(PHP_OS, 'win')) { + if (stristr(PHP_OS, 'darwin')) { + $this->assertEquals(0, $this->object->get('PMA_IS_WINDOWS')); + } elseif (stristr(PHP_OS, 'win')) { $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS')); } elseif (stristr(PHP_OS, 'OS/2')) { $this->assertEquals(1, $this->object->get('PMA_IS_WINDOWS')); From 46e7d3fd0ca97e064f9249e9fab3147378b47969 Mon Sep 17 00:00:00 2001 From: ayushchd Date: Fri, 5 Apr 2013 14:27:57 +0530 Subject: [PATCH 2/2] Implemented Config Test testGetThemeUniqueValue() --- test/classes/PMA_Config_test.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/test/classes/PMA_Config_test.php b/test/classes/PMA_Config_test.php index b4fa6b5b28..0c84255038 100644 --- a/test/classes/PMA_Config_test.php +++ b/test/classes/PMA_Config_test.php @@ -13,6 +13,7 @@ require_once 'libraries/core.lib.php'; require_once 'libraries/Config.class.php'; require_once 'libraries/relation.lib.php'; +require_once 'libraries/Theme.class.php'; class PMA_ConfigTest extends PHPUnit_Framework_TestCase { @@ -732,10 +733,27 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase */ public function testGetThemeUniqueValue() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' + + $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme'); + + $partial_sum = ( + PHPUnit_Framework_Assert::readAttribute($this->object, 'source_mtime') + + PHPUnit_Framework_Assert::readAttribute($this->object, 'default_source_mtime') + + $this->object->get('user_preferences_mtime') + + $_SESSION['PMA_Theme']->mtime_info + + $_SESSION['PMA_Theme']->filesize_info ); + + $this->object->set('fontsize', 10); + $this->assertEquals(10 + $partial_sum, $this->object->getThemeUniqueValue()); + $this->object->set('fontsize', NULL); + + $_COOKIE['pma_fontsize'] = 20; + $this->assertEquals(20 + $partial_sum, $this->object->getThemeUniqueValue()); + unset($_COOKIE['pma_fontsize']); + + $this->assertEquals($partial_sum, $this->object->getThemeUniqueValue()); + } /**