typo
[phpmyadmin/crack.git] / test / PMA_generateCommonUrl_test.php
blobb15ff2b643559b7fc9d65093163c7f642f734b60
1 <?php
2 /* vim: expandtab sw=4 ts=4 sts=4: */
3 /**
4 * tests for PMA_generate_common_url()
6 * @version $Id: PMA_get_real_size_test.php 10146 2007-03-20 14:16:18Z cybot_tm $
7 * @package phpMyAdmin-test
8 */
10 /**
13 require_once 'PHPUnit/Framework.php';
14 require_once './libraries/url_generating.lib.php';
16 class PMA_generate_common_url_test extends PHPUnit_Framework_TestCase
18 public function setUp()
20 unset($_COOKIE['pma_lang'], $_COOKIE['pma_charset'], $_COOKIE['pma_collation_connection']);
23 public function testOldStyle()
25 $GLOBALS['server'] = 'x';
26 $GLOBALS['lang'] = 'x';
27 $GLOBALS['convcharset'] = 'x';
28 $GLOBALS['collation_connection'] = 'x';
29 $_SESSION[' PMA_token '] = 'x';
30 $GLOBALS['cfg']['ServerDefault'] = 'y';
32 $separator = PMA_get_arg_separator();
33 $expected = 'server=x' . htmlentities($separator)
34 . 'lang=x' . htmlentities($separator)
35 . 'convcharset=x' . htmlentities($separator)
36 . 'collation_connection=x' . htmlentities($separator)
37 . 'token=x'
40 $expected = 'db=db'
41 . htmlentities($separator) . 'table=table'
42 . htmlentities($separator) . $expected;
44 $this->assertEquals($expected, PMA_generate_common_url('db', 'table'));
47 public function testOldStyleDbOnly()
49 $GLOBALS['server'] = 'x';
50 $GLOBALS['lang'] = 'x';
51 $GLOBALS['convcharset'] = '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 . 'convcharset=x' . htmlentities($separator)
60 . 'collation_connection=x' . htmlentities($separator)
61 . 'token=x'
64 $expected = 'db=db'
65 . htmlentities($separator) . $expected;
67 $this->assertEquals($expected, PMA_generate_common_url('db'));
70 public function testNewStyle()
72 $GLOBALS['server'] = 'x';
73 $GLOBALS['lang'] = 'x';
74 $GLOBALS['convcharset'] = 'x';
75 $GLOBALS['collation_connection'] = 'x';
76 $_SESSION[' PMA_token '] = 'x';
77 $GLOBALS['cfg']['ServerDefault'] = 'y';
79 $separator = PMA_get_arg_separator();
80 $expected = 'server=x' . htmlentities($separator)
81 . 'lang=x' . htmlentities($separator)
82 . 'convcharset=x' . htmlentities($separator)
83 . 'collation_connection=x' . htmlentities($separator)
84 . 'token=x'
87 $expected = '?db=db'
88 . htmlentities($separator) . 'table=table'
89 . htmlentities($separator) . $expected;
90 $params = array('db' => 'db', 'table' => 'table');
91 $this->assertEquals($expected, PMA_generate_common_url($params));
94 public function testOldStyleWithAlternateSeparator()
96 $GLOBALS['server'] = 'x';
97 $GLOBALS['lang'] = 'x';
98 $GLOBALS['convcharset'] = 'x';
99 $GLOBALS['collation_connection'] = 'x';
100 $_SESSION[' PMA_token '] = 'x';
101 $GLOBALS['cfg']['ServerDefault'] = 'y';
103 $separator = PMA_get_arg_separator();
104 $expected = 'server=x' . htmlentities($separator)
105 . 'lang=x' . htmlentities($separator)
106 . 'convcharset=x' . htmlentities($separator)
107 . 'collation_connection=x' . htmlentities($separator)
108 . 'token=x'
111 $expected = 'db=db'
112 . htmlentities($separator) . 'table=table'
113 . htmlentities($separator) . $expected;
114 $this->assertEquals($expected, PMA_generate_common_url('db', 'table', '&'));
117 public function testOldStyleWithAlternateSeparatorDbOnly()
119 $GLOBALS['server'] = 'x';
120 $GLOBALS['lang'] = 'x';
121 $GLOBALS['convcharset'] = 'x';
122 $GLOBALS['collation_connection'] = 'x';
123 $_SESSION[' PMA_token '] = 'x';
124 $GLOBALS['cfg']['ServerDefault'] = 'y';
126 $separator = PMA_get_arg_separator();
127 $expected = 'server=x' . htmlentities($separator)
128 . 'lang=x' . htmlentities($separator)
129 . 'convcharset=x' . htmlentities($separator)
130 . 'collation_connection=x' . htmlentities($separator)
131 . 'token=x'
134 $expected = 'db=db'
135 . htmlentities($separator) . $expected;
136 $this->assertEquals($expected, PMA_generate_common_url('db', '', '&'));
139 public function testDefault()
141 $GLOBALS['server'] = 'x';
142 $GLOBALS['lang'] = 'x';
143 $GLOBALS['convcharset'] = 'x';
144 $GLOBALS['collation_connection'] = 'x';
145 $_SESSION[' PMA_token '] = 'x';
146 $GLOBALS['cfg']['ServerDefault'] = 'y';
148 $separator = PMA_get_arg_separator();
149 $expected = 'server=x' . htmlentities($separator)
150 . 'lang=x' . htmlentities($separator)
151 . 'convcharset=x' . htmlentities($separator)
152 . 'collation_connection=x' . htmlentities($separator)
153 . 'token=x'
155 $this->assertEquals($expected, PMA_generate_common_url());