|
|
@ -24,6 +24,8 @@ class AutoloadBuilderTest extends PHPUnit_Framework_TestCase |
|
|
|
|
|
|
|
private static $path; |
|
|
|
|
|
|
|
private static $lib_path; |
|
|
|
|
|
|
|
private static $app; |
|
|
|
|
|
|
|
public function run(PHPUnit_Framework_TestResult $result = NULL) |
|
|
@ -38,13 +40,14 @@ class AutoloadBuilderTest extends PHPUnit_Framework_TestCase |
|
|
|
public static function setUpBeforeClass() |
|
|
|
{ |
|
|
|
self::$path = realpath(dirname(__FILE__) . '/../../../..'); |
|
|
|
self::$lib_path = realpath(dirname(__FILE__) . '/../..'); |
|
|
|
self::$app = 'lib/core/tests/face'; |
|
|
|
|
|
|
|
self::$file = self::$path . '/' . self::$app . '/cache/autoload.php'; |
|
|
|
|
|
|
|
self::$inc_dirs[self::$path . '/' . self::$app . '/src'] = true; |
|
|
|
self::$inc_dirs[self::$path . '/' . self::$app . '/cache'] = true; |
|
|
|
self::$inc_dirs[self::$path . '/lib'] = true; |
|
|
|
self::$inc_dirs[self::$lib_path . '/'] = true; |
|
|
|
|
|
|
|
foreach (self::$inc_dirs as $dir => &$is_exist) { |
|
|
|
if (!file_exists($dir)) { |
|
|
@ -83,6 +86,7 @@ class AutoloadBuilderTest extends PHPUnit_Framework_TestCase |
|
|
|
$this->assertFileExists(self::$file); |
|
|
|
|
|
|
|
$array = require self::$file; |
|
|
|
$this->assertFileExists(self::$file); |
|
|
|
$this->assertInternalType('array', $array); |
|
|
|
$this->assertNotEmpty($array); |
|
|
|
$this->assertArrayHasKey('AutoloadBuilder', $array); |
|
|
@ -95,7 +99,7 @@ class AutoloadBuilderTest extends PHPUnit_Framework_TestCase |
|
|
|
public function testBuildWithExcluded() |
|
|
|
{ |
|
|
|
$this->setConstants(); |
|
|
|
$builder = new AutoloadBuilder(self::$file, array_keys(self::$inc_dirs), array(self::$path . '/lib/core/app/')); |
|
|
|
$builder = new AutoloadBuilder(self::$file, array_keys(self::$inc_dirs), array(self::$lib_path . '/app/')); |
|
|
|
|
|
|
|
$this->assertFileNotExists(self::$file); |
|
|
|
$builder->build(); |
|
|
|