modified AutoloadBuilder to atomic write operation
This commit is contained in:
@ -77,6 +77,7 @@ class AutoloadBuilderTest extends PHPUnit_Framework_TestCase
|
||||
$this->setConstants();
|
||||
$builder = new AutoloadBuilder(self::$file, array(self::$path . '/' . self::$app . '/src', self::$path . '/' . self::$app . '/cache', self::$path . '/lib'));
|
||||
|
||||
$this->assertFileNotExists(self::$file);
|
||||
$builder->build();
|
||||
|
||||
$this->assertFileExists(self::$file);
|
||||
@ -84,6 +85,8 @@ class AutoloadBuilderTest extends PHPUnit_Framework_TestCase
|
||||
$array = require self::$file;
|
||||
$this->assertInternalType('array', $array);
|
||||
$this->assertNotEmpty($array);
|
||||
$this->assertArrayHasKey('AutoloadBuilder', $array);
|
||||
$this->assertArrayHasKey('Load', $array);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,7 +97,10 @@ class AutoloadBuilderTest extends PHPUnit_Framework_TestCase
|
||||
$this->setConstants();
|
||||
|
||||
$this->setExpectedException('PHPUnit_Framework_Error');
|
||||
$this->assertFileNotExists(self::$file);
|
||||
|
||||
touch(self::$file);
|
||||
$this->assertFileExists(self::$file);
|
||||
chmod(self::$file, 0400);
|
||||
$builder = new AutoloadBuilder(self::$file, array(self::$path . '/' . self::$app . '/src', self::$path . '/' . self::$app . '/cache', self::$path . '/lib'));
|
||||
|
||||
@ -102,15 +108,6 @@ class AutoloadBuilderTest extends PHPUnit_Framework_TestCase
|
||||
chmod(self::$file, 0777);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
// if (defined('PATH')) {
|
||||
// echo PHP_EOL . __CLASS__ . ' ' . PATH . PHP_EOL;
|
||||
// } else {
|
||||
// echo PHP_EOL . __CLASS__ . ' ' . 'PATH NOT DEFINED' . PHP_EOL;
|
||||
// }
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
if (file_exists(self::$file)) {
|
||||
|
Reference in New Issue
Block a user