diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 1d303eb106..18afa03982 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -1565,6 +1565,12 @@ class PMA_Config */ function removeCookie($cookie) { + if (defined('TESTSUITE')) { + if (isset($_COOKIE[$cookie])) { + unset($_COOKIE[$cookie]); + } + return true; + } return setcookie( $cookie, '', @@ -1614,6 +1620,10 @@ class PMA_Config } else { $v = time() + $validity; } + if (defined('TESTSUITE')) { + $_COOKIE[$cookie] = $value; + return true; + } return setcookie( $cookie, $value, diff --git a/test/classes/PMA_Config_test.php b/test/classes/PMA_Config_test.php index edb392a76f..ed736eb487 100644 --- a/test/classes/PMA_Config_test.php +++ b/test/classes/PMA_Config_test.php @@ -549,13 +549,9 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase */ public function testSetUserValue() { - $this->object->setUserValue(null, 'lang', $GLOBALS['lang'], 'en'); + $this->object->setUserValue(null, 'lang', 'cs', 'en'); $this->object->setUserValue("TEST_COOKIE_USER_VAL", '', 'cfg_val_1'); - - // Remove the following lines when you implement this test. -// $this->markTestIncomplete( -// 'This test has not been implemented yet.' -// ); + $this->assertEquals($this->object->getUserValue("TEST_COOKIE_USER_VAL", 'fail'), 'cfg_val_1'); } /** @@ -563,10 +559,7 @@ class PMA_ConfigTest extends PHPUnit_Framework_TestCase */ public function testGetUserValue() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->assertEquals($this->object->getUserValue('test_val', 'val'), 'val'); } /**