Remove some useless comments
[phpmyadmin.git] / test / classes / ListDatabaseTest.php
blob0231e33538de445ea0a791dbe9306a530d08dd69
1 <?php
3 declare(strict_types=1);
5 namespace PhpMyAdmin\Tests;
7 use PhpMyAdmin\ListDatabase;
9 class ListDatabaseTest extends AbstractTestCase
11 /**
12 * ListDatabase instance
14 * @var ListDatabase
16 private $object;
18 /**
19 * SetUp for test cases
21 protected function setUp(): void
23 parent::setUp();
24 $GLOBALS['server'] = 1;
25 $GLOBALS['cfg']['Server']['DisableIS'] = false;
26 $GLOBALS['cfg']['Server']['only_db'] = ['single\\_db'];
27 $this->object = new ListDatabase();
30 /**
31 * Test for ListDatabase::getEmpty
33 public function testEmpty(): void
35 $arr = new ListDatabase();
36 $this->assertEquals('', $arr->getEmpty());
39 /**
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';
53 $this->assertEquals(
56 'name' => 'single_db',
57 'is_selected' => false,
60 $arr->getList()
63 $GLOBALS['db'] = 'single_db';
64 $this->assertEquals(
67 'name' => 'single_db',
68 'is_selected' => true,
71 $arr->getList()
75 /**
76 * Test for checkHideDatabase
78 public function testCheckHideDatabase(): void
80 $GLOBALS['cfg']['Server']['hide_db'] = 'single\\_db';
81 $this->assertEquals(
82 $this->callFunction(
83 $this->object,
84 ListDatabase::class,
85 'checkHideDatabase',
92 /**
93 * Test for getDefault
95 public function testGetDefault(): void
97 $GLOBALS['db'] = '';
98 $this->assertEquals(
99 $this->object->getDefault(),
103 $GLOBALS['db'] = 'mysql';
104 $this->assertEquals(
105 $this->object->getDefault(),
106 'mysql'