better tests

This commit is contained in:
Anton Grebnev
2011-10-10 14:21:44 +04:00
parent 3c3071fb15
commit 7d12bcf26c
3 changed files with 53 additions and 1 deletions

View File

@ -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)) {