2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Test for PMA_expandUserString from common.lib.php
6 * @package phpMyAdmin-test
7 * @group common.lib-tests
13 require_once 'libraries/core.lib.php';
14 require_once 'libraries/common.lib.php';
16 if (!defined('PMA_VERSION')) {
17 define('PMA_VERSION', 'TEST');
21 * Test for PMA_expandUserString function.
23 class PMA_expandUserString_test
extends PHPUnit_Extensions_OutputTestCase
27 * Setup variables needed by test.
29 public function setup()
31 $GLOBALS['cfg'] = array(
34 'verbose' => 'verbose',
36 $GLOBALS['db'] = 'database';
37 $GLOBALS['table'] = 'table';
41 * Test case for expanding strings
43 * @dataProvider provider
45 public function testExpand($in, $out)
47 $this->assertEquals($out, PMA_expandUserString($in));
51 * Test case for expanding strings with escaping
53 * @dataProvider provider
55 public function testExpandEscape($in, $out)
57 $this->assertEquals(htmlspecialchars($out), PMA_expandUserString($in, 'htmlspecialchars'));
65 public function provider()
68 array('@SERVER@', 'host&'),
69 array('@VSERVER@', 'verbose'),
70 array('@DATABASE@', 'database'),
71 array('@TABLE@', 'table'),
72 array('@IGNORE@', '@IGNORE@'),
73 array('@PHPMYADMIN@', 'phpMyAdmin ' . PMA_VERSION
),