2 /* vim: set expandtab sw=4 ts=4 sts=4: */
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
14 require_once 'libraries/common.lib.php';
16 class PMA_getDbLink_test
extends PHPUnit_Framework_TestCase
21 require 'libraries/config.default.php';
24 function testGetDbLinkEmpty()
26 $GLOBALS['db'] = null;
27 $this->assertEmpty(PMA_getDbLink());
30 function testGetDbLinkNull()
33 $GLOBALS['db'] = 'test_db';
34 $database = $GLOBALS['db'];
35 $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database
36 . '&server=server&lang=en" title="Jump to database "' . htmlspecialchars($database) . '".">'
37 . htmlspecialchars($database) . '</a>',PMA_getDbLink());
40 function testGetDbLink()
43 $database = 'test_database';
44 $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . $database
45 . '&server=server&lang=en" title="Jump to database "' . htmlspecialchars($database) . '".">'
46 . htmlspecialchars($database) . '</a>',PMA_getDbLink($database));
49 function testGetDbLinkWithSpecialChars()
52 $database = 'test&data\'base';
53 $this->assertEquals('<a href="' . $cfg['DefaultTabDatabase'] . '?db=' . htmlspecialchars(urlencode($database))
54 . '&server=server&lang=en" title="Jump to database "' . htmlspecialchars($database) . '".">'
55 . htmlspecialchars($database) . '</a>',PMA_getDbLink($database));