The branch, master has been updated via e3306f098d5d46ad327e5aa4234ad767414ddc7f (commit) via 9b4128ed6e6703bb188a385261dae06c77c64a4b (commit) via 0c965a91adea145a2a7dbbc9f0626f40aded585f (commit) from 79c5b6b0e269f8bfa153f9bc6e61325804f99cc0 (commit)
- Log ----------------------------------------------------------------- commit e3306f098d5d46ad327e5aa4234ad767414ddc7f Author: Michal Čihař mcihar@suse.cz Date: Wed Aug 10 11:28:39 2011 +0200
Make test not dependending on set/non set variables
commit 9b4128ed6e6703bb188a385261dae06c77c64a4b Author: Michal Čihař mcihar@suse.cz Date: Wed Aug 10 11:26:29 2011 +0200
Make test not dependending on set/non set token
commit 0c965a91adea145a2a7dbbc9f0626f40aded585f Author: Michal Čihař mcihar@suse.cz Date: Wed Aug 10 11:25:13 2011 +0200
Make test not dependending on set/non set variables
-----------------------------------------------------------------------
Summary of changes: test/libraries/PMA_sanitize_test.php | 7 ++++++- test/libraries/common/PMA_getDbLink_test.php | 15 +++++++++++---- test/libraries/core/PMA_getLinks_test.php | 13 +++++++++++-- 3 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/test/libraries/PMA_sanitize_test.php b/test/libraries/PMA_sanitize_test.php index d6f8556..3f0cbf1 100644 --- a/test/libraries/PMA_sanitize_test.php +++ b/test/libraries/PMA_sanitize_test.php @@ -15,6 +15,11 @@ require_once 'libraries/core.lib.php';
class PMA_sanitize_test extends PHPUnit_Framework_TestCase { + function setUp() + { + $_SESSION[' PMA_token '] = 'token'; + } + /** * Tests for proper escaping of XSS. */ @@ -31,7 +36,7 @@ class PMA_sanitize_test extends PHPUnit_Framework_TestCase { unset($GLOBALS['server']); unset($GLOBALS['lang']); - $this->assertEquals('<a href="./url.php?url=http%3A%2F%2Fwww.phpmyadmin.net%2F" target="target">link</a>', + $this->assertEquals('<a href="./url.php?url=http%3A%2F%2Fwww.phpmyadmin.net%2F&token=token" target="target">link</a>', PMA_sanitize('[a@http://www.phpmyadmin.net/@target%5Dlink%5B/a]')); }
diff --git a/test/libraries/common/PMA_getDbLink_test.php b/test/libraries/common/PMA_getDbLink_test.php index 00053e1..eba4ec2 100644 --- a/test/libraries/common/PMA_getDbLink_test.php +++ b/test/libraries/common/PMA_getDbLink_test.php @@ -11,14 +11,21 @@ /* * Include to test. */ +require_once 'libraries/core.lib.php'; require_once 'libraries/common.lib.php'; +require_once 'libraries/url_generating.lib.php'; +require_once 'libraries/php-gettext/gettext.inc';
class PMA_getDbLink_test extends PHPUnit_Framework_TestCase { function setUp() { global $cfg; + require_once 'libraries/vendor_config.php'; require 'libraries/config.default.php'; + $_SESSION[' PMA_token '] = 'token'; + $GLOBALS['lang'] = 'en'; + $GLOBALS['server'] = 99; }
function testGetDbLinkEmpty() @@ -33,7 +40,7 @@ class PMA_getDbLink_test extends PHPUnit_Framework_TestCase $GLOBALS['db'] = 'test_db'; $database = $GLOBALS['db']; $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database - . '&server=server&lang=en" title="Jump to database "' . htmlspecialchars($database) . '".">' + . '&server=99&lang=en&token=token" title="Jump to database "' . htmlspecialchars($database) . '".">' . htmlspecialchars($database) . '</a>',PMA_getDbLink()); }
@@ -42,7 +49,7 @@ class PMA_getDbLink_test extends PHPUnit_Framework_TestCase global $cfg; $database = 'test_database'; $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database - . '&server=server&lang=en" title="Jump to database "' . htmlspecialchars($database) . '".">' + . '&server=99&lang=en&token=token" title="Jump to database "' . htmlspecialchars($database) . '".">' . htmlspecialchars($database) . '</a>',PMA_getDbLink($database)); }
@@ -51,7 +58,7 @@ class PMA_getDbLink_test extends PHPUnit_Framework_TestCase global $cfg; $database = 'test&data'base'; $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . htmlspecialchars(urlencode($database)) - . '&server=server&lang=en" title="Jump to database "' . htmlspecialchars($database) . '".">' + . '&server=99&lang=en&token=token" title="Jump to database "' . htmlspecialchars($database) . '".">' . htmlspecialchars($database) . '</a>',PMA_getDbLink($database)); } -} \ No newline at end of file +} diff --git a/test/libraries/core/PMA_getLinks_test.php b/test/libraries/core/PMA_getLinks_test.php index 59aac3e..5930608 100644 --- a/test/libraries/core/PMA_getLinks_test.php +++ b/test/libraries/core/PMA_getLinks_test.php @@ -11,9 +11,18 @@ */ require_once 'libraries/core.lib.php'; require_once 'libraries/url_generating.lib.php'; +require_once 'libraries/php-gettext/gettext.inc';
class PMA_getLinks_test extends PHPUnit_Framework_TestCase { + function setUp() + { + $_SESSION[' PMA_token '] = 'token'; + $GLOBALS['lang'] = 'en'; + $GLOBALS['server'] = 99; + $GLOBALS['cfg']['ServerDefault'] = 0; + } + public function testPMA_getPHPDocLink() { $lang = _pgettext('PHP documentation language', 'en'); @@ -22,8 +31,8 @@ class PMA_getLinks_test extends PHPUnit_Framework_TestCase
public function providerLinkURL(){ return array( - array('http://wiki.phpmyadmin.net', './url.php?url=http%3A%2F%2Fwiki.phpmyadmin.net&lang=en'), - array('https://wiki.phpmyadmin.net', './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net&lang=en'), + array('http://wiki.phpmyadmin.net', './url.php?url=http%3A%2F%2Fwiki.phpmyadmin.net&server=99&lang=en&token=token'), + array('https://wiki.phpmyadmin.net', './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net&server=99&lang=en&token=token'), array('wiki.phpmyadmin.net', 'wiki.phpmyadmin.net'), array('index.php?db=phpmyadmin', 'index.php?db=phpmyadmin') );
hooks/post-receive