1
0
mirror of https://github.com/phpmyadmin/phpmyadmin.git synced 2026-10-31 10:54:46 +03:00
Files
phpmyadmin/test/classes/PMA_List_Database_test.php
Hugues Peccatte 2fe6ff4655 Set namespace on Advisor, Config, Console and Util classes.
Set namespace on DbQbe.
Set namespace to 'DbSearch'.
Split Advisor.class.php file.
Change Advisor namespace.
Rename DbQbe class and file.
Set namespace on DisplayResults.
Set namespace on Error.
Use namespace for ErrorHandler.
Add class autoloader.
Change ErrorHandler filename.
Remove some require.
Update Config namespace path.
Update PMA_Util to PMA\libraries\Util.
Rename Font and File classes files.
Use namespace for Footer.
Set namespace in all libraries classes.
Namespace OutputBuffering.
Export SubPartition.
Rename Partition file.
Namespace PDF.
Namespace RecentFavoriteTable.
Replace PMA_Response by Response and PMA_Message by Message.
Update uses and calls.
Fix unit tests.
Fix SqlParser autoload.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
2015-08-29 16:27:21 +02:00

128 lines
2.7 KiB
PHP

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for ListDatabase class
*
* @package PhpMyAdmin-test
*/
use PMA\libraries\ListDatabase;
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
/*
* Include to test.
*/
require_once 'libraries/Util.php';
require_once 'libraries/ListDatabase.php';
require_once 'libraries/relation.lib.php';
/**
* tests for ListDatabase class
*
* @package PhpMyAdmin-test
*/
class PMA_List_Database_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
* @return void
*/
public function setup()
{
$GLOBALS['cfg']['Server']['only_db'] = array('single\\_db');
$this->object = new ListDatabase();
}
/**
* Call protected functions by setting visibility to public.
*
* @param string $name method name
* @param array $params parameters for the invocation
*
* @return the output from the protected method.
*/
private function _callProtectedFunction($name, $params)
{
$class = new ReflectionClass('ListDatabase');
$method = $class->getMethod($name);
$method->setAccessible(true);
return $method->invokeArgs($this->object, $params);
}
/**
* Test for ListDatabase::getEmpty
*
* @return void
*/
public function testEmpty()
{
$arr = new ListDatabase;
$this->assertEquals('', $arr->getEmpty());
}
/**
* Test for ListDatabase::exists
*
* @return void
*/
public function testExists()
{
$arr = new ListDatabase;
$this->assertEquals(true, $arr->exists('single_db'));
}
/**
* Test for ListDatabase::getHtmlOptions
*
* @return void
*/
public function testHtmlOptions()
{
$arr = new ListDatabase;
$this->assertEquals(
'<option value="single_db">single_db</option>' . "\n",
$arr->getHtmlOptions()
);
}
/**
* Test for checkHideDatabase
*
* @return void
*/
public function testCheckHideDatabase()
{
$GLOBALS['cfg']['Server']['hide_db'] = 'single\\_db';
$this->assertEquals(
$this->_callProtectedFunction(
'checkHideDatabase',
array()
),
''
);
}
/**
* Test for getDefault
*
* @return void
*/
public function testGetDefault()
{
$GLOBALS['db'] = '';
$this->assertEquals(
$this->object->getDefault(),
''
);
$GLOBALS['db'] = 'mysql';
$this->assertEquals(
$this->object->getDefault(),
'mysql'
);
}
}