Advisor: mark that 'Rate of reading fixed position' may be wrong, requires further...
[phpmyadmin/thilanka.git] / test / libraries / common / PMA_getDbLink_test.php
blobeba4ec2aa09703cfa21e8f1676b14d49f21b5bfe
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for PMA_getDbLink_test from common.lib.php
6 * @package phpMyAdmin-test
7 * @version $Id: PMA_getDbLink_test.php
8 * @group common.lib-tests
9 */
12 * Include to test.
14 require_once 'libraries/core.lib.php';
15 require_once 'libraries/common.lib.php';
16 require_once 'libraries/url_generating.lib.php';
17 require_once 'libraries/php-gettext/gettext.inc';
19 class PMA_getDbLink_test extends PHPUnit_Framework_TestCase
21 function setUp()
23 global $cfg;
24 require_once 'libraries/vendor_config.php';
25 require 'libraries/config.default.php';
26 $_SESSION[' PMA_token '] = 'token';
27 $GLOBALS['lang'] = 'en';
28 $GLOBALS['server'] = 99;
31 function testGetDbLinkEmpty()
33 $GLOBALS['db'] = null;
34 $this->assertEmpty(PMA_getDbLink());
37 function testGetDbLinkNull()
39 global $cfg;
40 $GLOBALS['db'] = 'test_db';
41 $database = $GLOBALS['db'];
42 $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database
43 . '&amp;server=99&amp;lang=en&amp;token=token" title="Jump to database &quot;' . htmlspecialchars($database) . '&quot;.">'
44 . htmlspecialchars($database) . '</a>',PMA_getDbLink());
47 function testGetDbLink()
49 global $cfg;
50 $database = 'test_database';
51 $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database
52 . '&amp;server=99&amp;lang=en&amp;token=token" title="Jump to database &quot;' . htmlspecialchars($database) . '&quot;.">'
53 . htmlspecialchars($database) . '</a>',PMA_getDbLink($database));
56 function testGetDbLinkWithSpecialChars()
58 global $cfg;
59 $database = 'test&data\'base';
60 $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . htmlspecialchars(urlencode($database))
61 . '&amp;server=99&amp;lang=en&amp;token=token" title="Jump to database &quot;' . htmlspecialchars($database) . '&quot;.">'
62 . htmlspecialchars($database) . '</a>',PMA_getDbLink($database));