-
Notifications
You must be signed in to change notification settings - Fork 510
/
Copy pathConfigTest.php
59 lines (47 loc) · 1.48 KB
/
ConfigTest.php
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
<?php
/**
* @author gaobinzhan <[email protected]>
*/
namespace EasySwoole\EasySwoole\Test;
use EasySwoole\Config\AbstractConfig;
use EasySwoole\Config\TableConfig;
use EasySwoole\EasySwoole\Config;
use PHPUnit\Framework\TestCase;
class ConfigTest extends TestCase
{
public function testStorageHandler()
{
$config = new TableConfig();
$this->assertInstanceOf(AbstractConfig::class, Config::getInstance()->storageHandler($config));
}
public function testGetConf()
{
$conf = Config::getInstance()->getConf();
$this->assertEmpty($conf);
}
public function testSetConf()
{
$bool = Config::getInstance()->setConf('test', 'easyswoole.php');
$this->assertTrue($bool);
$this->assertEquals('easyswoole.php', Config::getInstance()->getConf('test'));
}
public function testLoad()
{
$bool = Config::getInstance()->load(['test' => 'easyswoole.php']);
$this->assertTrue($bool);
$conf = Config::getInstance()->getConf();
$this->assertEquals(['test' => 'easyswoole.php'], $conf);
}
public function testMerge()
{
$bool = Config::getInstance()->merge(['test' => 'easyswoole.php']);
$this->assertTrue($bool);
$conf = Config::getInstance()->getConf();
$this->assertEquals(['test' => 'easyswoole.php'], $conf);
}
public function testClear()
{
$bool = Config::getInstance()->clear();
$this->assertTrue($bool);
}
}