3 declare(strict_types
=1);
5 namespace PhpMyAdmin\Tests
;
7 use PhpMyAdmin\ListDatabase
;
9 class ListDatabaseTest
extends AbstractTestCase
12 * ListDatabase instance
19 * SetUp for test cases
21 protected function setUp(): void
24 $GLOBALS['server'] = 1;
25 $GLOBALS['cfg']['Server']['DisableIS'] = false;
26 $GLOBALS['cfg']['Server']['only_db'] = ['single\\_db'];
27 $this->object = new ListDatabase();
31 * Test for ListDatabase::getEmpty
33 public function testEmpty(): void
35 $arr = new ListDatabase();
36 $this->assertEquals('', $arr->getEmpty());
40 * Test for ListDatabase::exists
42 public function testExists(): void
44 $arr = new ListDatabase();
45 $this->assertTrue($arr->exists('single_db'));
48 public function testGetList(): void
50 $arr = new ListDatabase();
52 $GLOBALS['db'] = 'db';
56 'name' => 'single_db',
57 'is_selected' => false,
63 $GLOBALS['db'] = 'single_db';
67 'name' => 'single_db',
68 'is_selected' => true,
76 * Test for checkHideDatabase
78 public function testCheckHideDatabase(): void
80 $GLOBALS['cfg']['Server']['hide_db'] = 'single\\_db';
95 public function testGetDefault(): void
99 $this->object->getDefault(),
103 $GLOBALS['db'] = 'mysql';
105 $this->object->getDefault(),