|
|
@ -10,6 +10,7 @@ |
|
|
|
* Unit tests for AutoloadBuilder class |
|
|
|
*/ |
|
|
|
|
|
|
|
require_once 'vfsStream/vfsStream.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../util/AutoloadBuilder.php'; |
|
|
|
|
|
|
|
/** |
|
|
@ -65,12 +66,40 @@ class AutoloadBuilderTest extends PHPUnit_Framework_TestCase |
|
|
|
$builder->build(); |
|
|
|
} |
|
|
|
|
|
|
|
public function testBuild() |
|
|
|
{ |
|
|
|
$builder = new AutoloadBuilder(self::$file, array(PATH . '/' . APP . '/src', PATH . '/' . APP . '/cache', PATH . '/lib')); |
|
|
|
|
|
|
|
$builder->build(); |
|
|
|
|
|
|
|
$this->assertFileExists(self::$file); |
|
|
|
} |
|
|
|
|
|
|
|
public function testAutoloadFileExists() |
|
|
|
{ |
|
|
|
$this->assertFileExists(self::$file); |
|
|
|
} |
|
|
|
|
|
|
|
public function testAutoloadArray() |
|
|
|
{ |
|
|
|
$this->assertFileExists(self::$file); |
|
|
|
$array = require self::$file; |
|
|
|
$this->assertInternalType('array', $array); |
|
|
|
$this->assertNotEmpty($array); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @expectedException PHPUnit_Framework_Error |
|
|
|
*/ |
|
|
|
public function testAccessDenied() |
|
|
|
{ |
|
|
|
chmod(self::$file, 0400); |
|
|
|
$builder = new AutoloadBuilder(self::$file, array(PATH . '/' . APP . '/src', PATH . '/' . APP . '/cache', PATH . '/lib')); |
|
|
|
|
|
|
|
$builder->build(); |
|
|
|
chmod(self::$file, 0777); |
|
|
|
} |
|
|
|
|
|
|
|
public static function tearDownAfterClass() |
|
|
|
{ |
|
|
|
if (file_exists(self::$file)) { |
|
|
|