assertEquals($expected, PMA_URL_getCommon('db', 'table')); } public function testOldStyleDbOnly() { $GLOBALS['server'] = 'x'; $GLOBALS['collation_connection'] = 'x'; $GLOBALS['cfg']['ServerDefault'] = 'y'; $separator = PMA_URL_getArgSeparator(); $expected = 'server=x' . htmlentities($separator) . 'lang=en' . htmlentities($separator) . 'collation_connection=x' . htmlentities($separator) . 'token=token' ; $expected = 'db=db' . htmlentities($separator) . $expected; $this->assertEquals($expected, PMA_URL_getCommon('db')); } public function testNewStyle() { $GLOBALS['server'] = 'x'; $GLOBALS['collation_connection'] = 'x'; $GLOBALS['cfg']['ServerDefault'] = 'y'; $separator = PMA_URL_getArgSeparator(); $expected = 'server=x' . htmlentities($separator) . 'lang=en' . htmlentities($separator) . 'collation_connection=x' . htmlentities($separator) . 'token=token' ; $expected = '?db=db' . htmlentities($separator) . 'table=table' . htmlentities($separator) . $expected; $params = array('db' => 'db', 'table' => 'table'); $this->assertEquals($expected, PMA_URL_getCommon($params)); } public function testOldStyleWithAlternateSeparator() { $GLOBALS['server'] = 'x'; $GLOBALS['collation_connection'] = 'x'; $GLOBALS['cfg']['ServerDefault'] = 'y'; $separator = PMA_URL_getArgSeparator(); $expected = 'server=x' . $separator . 'lang=en' . $separator . 'collation_connection=x' . $separator . 'token=token' ; $expected = 'db=db' . $separator . 'table=table' . $separator . $expected; $this->assertEquals($expected, PMA_URL_getCommon('db', 'table', '&')); } public function testOldStyleWithAlternateSeparatorDbOnly() { $GLOBALS['server'] = 'x'; $GLOBALS['collation_connection'] = 'x'; $GLOBALS['cfg']['ServerDefault'] = 'y'; $separator = PMA_URL_getArgSeparator(); $expected = 'server=x' . $separator . 'lang=en' . $separator . 'collation_connection=x' . $separator . 'token=token' ; $expected = 'db=db' . $separator . $expected; $this->assertEquals($expected, PMA_URL_getCommon('db', '', '&')); } public function testDefault() { $GLOBALS['server'] = 'x'; $GLOBALS['collation_connection'] = 'x'; $GLOBALS['cfg']['ServerDefault'] = 'y'; $separator = PMA_URL_getArgSeparator(); $expected = 'server=x' . htmlentities($separator) . 'lang=en' . htmlentities($separator) . 'collation_connection=x' . htmlentities($separator) . 'token=token' ; $this->assertEquals($expected, PMA_URL_getCommon()); } } ?>