Remove misleading comment on the "Rename database" interface
[phpmyadmin/ammaryasirr.git] / test / PMA_generateCommonUrl_test.php
blob22e948b6b6fca583b2e891c8c676233e44fb289f
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * tests for PMA_generate_common_url()
6 * @package phpMyAdmin-test
7 */
9 /**
12 require_once 'PHPUnit/Framework.php';
13 require_once './libraries/core.lib.php';
14 require_once './libraries/url_generating.lib.php';
16 /**
17 * @package phpMyAdmin-test
19 class PMA_generate_common_url_test extends PHPUnit_Framework_TestCase
21 public function setUp()
23 unset($_COOKIE['pma_lang'], $_COOKIE['pma_collation_connection']);
26 public function testOldStyle()
28 $GLOBALS['server'] = 'x';
29 $GLOBALS['lang'] = 'x';
30 $GLOBALS['collation_connection'] = 'x';
31 $_SESSION[' PMA_token '] = 'x';
32 $GLOBALS['cfg']['ServerDefault'] = 'y';
34 $separator = PMA_get_arg_separator();
35 $expected = 'server=x' . htmlentities($separator)
36 . 'lang=x' . htmlentities($separator)
37 . 'collation_connection=x' . htmlentities($separator)
38 . 'token=x'
41 $expected = 'db=db'
42 . htmlentities($separator) . 'table=table'
43 . htmlentities($separator) . $expected;
45 $this->assertEquals($expected, PMA_generate_common_url('db', 'table'));
48 public function testOldStyleDbOnly()
50 $GLOBALS['server'] = 'x';
51 $GLOBALS['lang'] = 'x';
52 $GLOBALS['collation_connection'] = 'x';
53 $_SESSION[' PMA_token '] = 'x';
54 $GLOBALS['cfg']['ServerDefault'] = 'y';
56 $separator = PMA_get_arg_separator();
57 $expected = 'server=x' . htmlentities($separator)
58 . 'lang=x' . htmlentities($separator)
59 . 'collation_connection=x' . htmlentities($separator)
60 . 'token=x'
63 $expected = 'db=db'
64 . htmlentities($separator) . $expected;
66 $this->assertEquals($expected, PMA_generate_common_url('db'));
69 public function testNewStyle()
71 $GLOBALS['server'] = 'x';
72 $GLOBALS['lang'] = 'x';
73 $GLOBALS['collation_connection'] = 'x';
74 $_SESSION[' PMA_token '] = 'x';
75 $GLOBALS['cfg']['ServerDefault'] = 'y';
77 $separator = PMA_get_arg_separator();
78 $expected = 'server=x' . htmlentities($separator)
79 . 'lang=x' . htmlentities($separator)
80 . 'collation_connection=x' . htmlentities($separator)
81 . 'token=x'
84 $expected = '?db=db'
85 . htmlentities($separator) . 'table=table'
86 . htmlentities($separator) . $expected;
87 $params = array('db' => 'db', 'table' => 'table');
88 $this->assertEquals($expected, PMA_generate_common_url($params));
91 public function testOldStyleWithAlternateSeparator()
93 $GLOBALS['server'] = 'x';
94 $GLOBALS['lang'] = 'x';
95 $GLOBALS['collation_connection'] = 'x';
96 $_SESSION[' PMA_token '] = 'x';
97 $GLOBALS['cfg']['ServerDefault'] = 'y';
99 $separator = PMA_get_arg_separator();
100 $expected = 'server=x' . $separator
101 . 'lang=x' . $separator
102 . 'collation_connection=x' . $separator
103 . 'token=x'
106 $expected = 'db=db' . $separator . 'table=table' . $separator . $expected;
107 $this->assertEquals($expected, PMA_generate_common_url('db', 'table', '&'));
110 public function testOldStyleWithAlternateSeparatorDbOnly()
112 $GLOBALS['server'] = 'x';
113 $GLOBALS['lang'] = 'x';
114 $GLOBALS['collation_connection'] = 'x';
115 $_SESSION[' PMA_token '] = 'x';
116 $GLOBALS['cfg']['ServerDefault'] = 'y';
118 $separator = PMA_get_arg_separator();
119 $expected = 'server=x' . $separator
120 . 'lang=x' . $separator
121 . 'collation_connection=x' . $separator
122 . 'token=x'
125 $expected = 'db=db' . $separator . $expected;
126 $this->assertEquals($expected, PMA_generate_common_url('db', '', '&'));
129 public function testDefault()
131 $GLOBALS['server'] = 'x';
132 $GLOBALS['lang'] = 'x';
133 $GLOBALS['collation_connection'] = 'x';
134 $_SESSION[' PMA_token '] = 'x';
135 $GLOBALS['cfg']['ServerDefault'] = 'y';
137 $separator = PMA_get_arg_separator();
138 $expected = 'server=x' . htmlentities($separator)
139 . 'lang=x' . htmlentities($separator)
140 . 'collation_connection=x' . htmlentities($separator)
141 . 'token=x'
143 $this->assertEquals($expected, PMA_generate_common_url());