phpmyadmin/test/libraries/common/PMA_expandUserString_test.php
Michal Čihař eddbee7e73 Use PHPUnit_Framework_TestCase insead of PHPUnit_Extensions_OutputTestCase
This is needed for phpunit 3.6 (otherwise it throws out tons of
warnings).
2011-12-19 14:59:42 +01:00

77 lines
1.7 KiB
PHP

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA_expandUserString from common.lib.php
*
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
/*
* Include to test.
*/
require_once 'libraries/core.lib.php';
require_once 'libraries/common.lib.php';
if (!defined('PMA_VERSION')) {
define('PMA_VERSION', 'TEST');
}
/**
* Test for PMA_expandUserString function.
*/
class PMA_expandUserString_test extends PHPUnit_Framework_TestCase
{
/**
* Setup variables needed by test.
*/
public function setup()
{
$GLOBALS['cfg'] = array(
'Server' => array(
'host' => 'host&',
'verbose' => 'verbose',
));
$GLOBALS['db'] = 'database';
$GLOBALS['table'] = 'table';
}
/**
* Test case for expanding strings
*
* @dataProvider provider
*/
public function testExpand($in, $out)
{
$this->assertEquals($out, PMA_expandUserString($in));
}
/**
* Test case for expanding strings with escaping
*
* @dataProvider provider
*/
public function testExpandEscape($in, $out)
{
$this->assertEquals(htmlspecialchars($out), PMA_expandUserString($in, 'htmlspecialchars'));
}
/**
* Data provider
*
* @return array
*/
public function provider()
{
return array(
array('@SERVER@', 'host&'),
array('@VSERVER@', 'verbose'),
array('@DATABASE@', 'database'),
array('@TABLE@', 'table'),
array('@IGNORE@', '@IGNORE@'),
array('@PHPMYADMIN@', 'phpMyAdmin ' . PMA_VERSION),
);
}
}