forked from phalapi/phalapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhalApi_Config_File_Test.php
66 lines (50 loc) · 1.27 KB
/
PhalApi_Config_File_Test.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
60
61
62
63
64
65
66
<?php
/**
* PhpUnderControl_PhalApiConfigFile_Test
*
* 针对 ../PhalApi/Config/File.php PhalApi_Config_File 类的PHPUnit单元测试
*
* @author: dogstar 20141004
*/
require_once dirname(__FILE__) . '/test_env.php';
if (!class_exists('PhalApi_Config_File')) {
require dirname(__FILE__) . '/../PhalApi/Config/File.php';
}
class PhpUnderControl_PhalApiConfigFile_Test extends PHPUnit_Framework_TestCase
{
public $coreConfigFile;
protected function setUp()
{
parent::setUp();
$this->coreConfigFile = DI()->config;
}
protected function tearDown()
{
}
public function testConstruct()
{
$config = new PhalApi_Config_File(dirname(__FILE__) . '/Config');
}
/**
* @group testGet
*/
public function testGetDefault()
{
$key = 'sys.noThisKey';
$default = 2014;
$rs = $this->coreConfigFile->get($key, $default);
$this->assertSame($default, $rs);
}
public function testGetNormal()
{
$key = 'sys.debug';
$rs = $this->coreConfigFile->get($key);
$this->assertFalse($rs);
}
public function testGetAll()
{
$key = 'dbs';
$rs = $this->coreConfigFile->get($key);
$this->assertTrue(is_array($rs));
}
}