2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * tests for PMA_List_Database class
6 * @package PhpMyAdmin-test
12 require_once 'libraries/Util.class.php';
13 require_once 'libraries/List_Database.class.php';
14 require_once 'libraries/relation.lib.php';
17 * tests for PMA_List_Database class
19 * @package PhpMyAdmin-test
21 class PMA_List_Database_Test
extends PHPUnit_Framework_TestCase
24 * SetUp for test cases
28 public function setup()
30 $GLOBALS['cfg']['Server']['only_db'] = array('single\\_db');
31 $this->object = new PMA_List_Database();
35 * Call protected functions by setting visibility to public.
37 * @param string $name method name
38 * @param array $params parameters for the invocation
40 * @return the output from the protected method.
42 private function _callProtectedFunction($name, $params)
44 $class = new ReflectionClass('PMA_List_Database');
45 $method = $class->getMethod($name);
46 $method->setAccessible(true);
47 return $method->invokeArgs($this->object, $params);
51 * Test for PMA_List_Database::getEmpty
55 public function testEmpty()
57 $arr = new PMA_List_Database
;
58 $this->assertEquals('', $arr->getEmpty());
62 * Test for PMA_List_Database::getSingleItem
66 public function testSingle()
68 $arr = new PMA_List_Database
;
69 $this->assertEquals('single_db', $arr->getSingleItem());
73 * Test for PMA_List_Database::exists
77 public function testExists()
79 $arr = new PMA_List_Database
;
80 $this->assertEquals(true, $arr->exists('single_db'));
84 * Test for PMA_List_Database::getHtmlOptions
88 public function testHtmlOptions()
90 $arr = new PMA_List_Database
;
92 '<option value="single_db">single_db</option>' . "\n",
93 $arr->getHtmlOptions()
98 * Test for checkHideDatabase
102 public function testCheckHideDatabase()
104 $GLOBALS['cfg']['Server']['hide_db'] = 'single\\_db';
106 $this->_callProtectedFunction(
115 * Test for getDefault
119 public function testGetDefault()
123 $this->object->getDefault(),
127 $GLOBALS['db'] = 'mysql';
129 $this->object->getDefault(),