-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Expand file tree
/
Copy pathThemeManagerTest.php
More file actions
74 lines (65 loc) · 1.91 KB
/
ThemeManagerTest.php
File metadata and controls
74 lines (65 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\ThemeManager;
/**
* @covers \PhpMyAdmin\ThemeManager
*/
class ThemeManagerTest extends AbstractTestCase
{
/**
* SetUp for test cases
*/
protected function setUp(): void
{
parent::setUp();
parent::setGlobalConfig();
$GLOBALS['cfg']['ThemePerServer'] = false;
$GLOBALS['cfg']['ThemeDefault'] = 'pmahomme';
$GLOBALS['cfg']['ServerDefault'] = 0;
$GLOBALS['server'] = 99;
$dbi = $this->getMockBuilder(DatabaseInterface::class)
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->any())->method('escapeString')
->will($this->returnArgument(0));
}
/**
* Test for ThemeManager::getThemeCookieName
*/
public function testCookieName(): void
{
$tm = new ThemeManager();
self::assertSame('pma_theme', $tm->getThemeCookieName());
}
/**
* Test for ThemeManager::getThemeCookieName
*/
public function testPerServerCookieName(): void
{
$tm = new ThemeManager();
$tm->setThemePerServer(true);
self::assertSame('pma_theme-99', $tm->getThemeCookieName());
}
public function testGetThemesArray(): void
{
$tm = new ThemeManager();
$themes = $tm->getThemesArray();
self::assertIsArray($themes);
self::assertArrayHasKey(0, $themes);
self::assertIsArray($themes[0]);
self::assertArrayHasKey('id', $themes[0]);
self::assertArrayHasKey('name', $themes[0]);
self::assertArrayHasKey('version', $themes[0]);
self::assertArrayHasKey('is_active', $themes[0]);
}
/**
* Test for setThemeCookie
*/
public function testSetThemeCookie(): void
{
$tm = new ThemeManager();
self::assertTrue($tm->setThemeCookie());
}
}