forked from yiisoft/yii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestApplication.php
63 lines (54 loc) · 1.07 KB
/
TestApplication.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
<?php
class TestApplication extends CWebApplication
{
public function __construct($config=null)
{
Yii::setApplication(null);
clearstatcache();
parent::__construct($config);
}
public function reset()
{
$this->removeDirectory($this->getRuntimePath());
$this->removeDirectory($this->getAssetPath());
}
protected function removeDirectory($path)
{
if(is_dir($path) && ($folder=@opendir($path))!==false)
{
while($entry=@readdir($folder))
{
if($entry[0]==='.')
continue;
$p=$path.DIRECTORY_SEPARATOR.$entry;
if(is_dir($p))
$this->removeDirectory($p);
@unlink($p);
}
@closedir($folder);
}
}
public function getAssetPath()
{
return dirname(__FILE__).DIRECTORY_SEPARATOR.'assets';
}
public function getRuntimePath()
{
return dirname(__FILE__).DIRECTORY_SEPARATOR.'runtime';
}
public function getBasePath()
{
return dirname(__FILE__);
}
public function setBasePath($value)
{
}
public function loadGlobalState()
{
parent::loadGlobalState();
}
public function saveGlobalState()
{
parent::saveGlobalState();
}
}