colly_wyx
2018-05-18 50a53f7db63c5729b0ddbc93367117cf35ccf03c
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
 * PhpUnderControl_PhalApiLoader_Test
 *
 * 针对 ../PhalApi/Loader.php PhalApi_Loader 类的PHPUnit单元测试
 *
 * @author: dogstar 20141004
 */
 
require_once dirname(__FILE__) . '/test_env.php';
 
if (!class_exists('PhalApi_Loader')) {
    require dirname(__FILE__) . '/../PhalApi/Loader.php';
}
 
class PhpUnderControl_PhalApiLoader_Test extends PHPUnit_Framework_TestCase
{
    public $coreLoader;
 
    protected function setUp()
    {
        parent::setUp();
 
        $this->coreLoader = DI()->loader;
    }
 
    protected function tearDown()
    {
    }
 
 
    /**
     * @group testAddDirs
     */ 
    public function testAddDirs()
    {
        $dirs = array('FirstDir', 'SecondDir');
 
        $this->coreLoader->addDirs($dirs);
    }
 
    /**
     * @group testSetBasePath
     */ 
    public function testSetBasePath()
    {
        $path = PHALAPI_ROOT;
 
        $rs = $this->coreLoader->setBasePath($path);
    }
 
    /**
     * @group testLoadFile
     */ 
    public function testLoadFile()
    {
        $filePath = dirname(__FILE__) . '/test_file_for_loader.php';
 
        $this->coreLoader->loadFile($filePath);
    }
 
    /**
     * @group testLoad
     */ 
    public function testLoad()
    {
        $className = 'PhalApi_Api';
 
        $rs = $this->coreLoader->load($className);
    }
 
    public function testLoadOnce()
    {
        $obj = new PhalApi_Logger_File('./', 0);
    }
 
    public function testRegisterAgain()
    {
        $loader = new PhalApi_Loader('./', array());
        $loader = new PhalApi_Loader('./', array());
 
        $obj = new PhalApi_DB_NotORM(array());
    }
 
    public function testConstructAndAdd()
    {
        $loader = new PhalApi_Loader('./', array('./Config'));
        $loader->addDirs('./Data');
        $loader->addDirs(array('./Crypt'));
    }
}