little changes in files
This commit is contained in:
@ -10,8 +10,8 @@
|
|||||||
* Unit tests for Config class
|
* Unit tests for Config class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once '../Registry.php';
|
require_once dirname(__FILE__) . '/../Registry.php';
|
||||||
require_once '../Config.php';
|
require_once dirname(__FILE__) . '/../Config.php';
|
||||||
|
|
||||||
class ConfigTest extends PHPUnit_Framework_TestCase
|
class ConfigTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
* Unit tests for Load class
|
* Unit tests for Load class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
require dirname(__FILE__) . '/../Load.php';
|
||||||
|
|
||||||
class LoadTest extends PHPUnit_Framework_TestCase
|
class LoadTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -23,19 +25,21 @@ class LoadTest extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
define('PATH', realpath(dirname(__FILE__) . '/../../..'));
|
if (!defined('PATH')) {
|
||||||
|
define('PATH', realpath(dirname(__FILE__) . '/../../..'));
|
||||||
|
}
|
||||||
|
|
||||||
// default application name
|
// default application name
|
||||||
if (!defined('APP')) {
|
if (!defined('APP')) {
|
||||||
define('APP', 'lib/core/tests/face');
|
define('APP', 'lib/core/tests/face');
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$file = PATH . '/'. APP. '/cache//autoload.php';
|
self::$file = PATH . '/' . APP . '/cache/autoload.php';
|
||||||
|
|
||||||
// value - if dir exists (to delete it if it was created), default true
|
// value - if dir exists (to delete it if it was created), default true
|
||||||
self::$inc_dirs[PATH . '/' . APP . '/src'] = true;
|
self::$inc_dirs[PATH . '/' . APP . '/src'] = true;
|
||||||
self::$inc_dirs[PATH . '/' . APP . '/cache'] = true;
|
self::$inc_dirs[PATH . '/' . APP . '/cache'] = true;
|
||||||
self::$inc_dirs[PATH . '/lib'] = true;
|
self::$inc_dirs[PATH . '/lib'] = true;
|
||||||
|
|
||||||
foreach (self::$inc_dirs as $dir => &$is_exist) {
|
foreach (self::$inc_dirs as $dir => &$is_exist) {
|
||||||
if (!file_exists($dir)) {
|
if (!file_exists($dir)) {
|
||||||
@ -45,44 +49,42 @@ class LoadTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSetAutoLoadFrom()
|
||||||
public function testSetAutoLoadFrom()
|
|
||||||
{
|
{
|
||||||
// autoload
|
// autoload
|
||||||
require (PATH . '/lib/core/Load.php');
|
|
||||||
Load::setAutoloadFrom(self::$file);
|
Load::setAutoloadFrom(self::$file);
|
||||||
|
|
||||||
$autoload = require(self::$file);
|
$autoload = require(self::$file);
|
||||||
$this->assertNotEmpty($autoload);
|
$this->assertNotEmpty($autoload);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAutoloadArrayExists()
|
public function testAutoloadArrayExists()
|
||||||
{
|
{
|
||||||
$this->assertFileExists(self::$file);
|
$this->assertFileExists(self::$file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @TODO: Load - check if input file returns array
|
* @TODO: Load - check if input file returns array
|
||||||
*/
|
*/
|
||||||
public function testFileForArray()
|
public function testFileForArray()
|
||||||
{
|
{
|
||||||
$autoload = require(self::$file);
|
$autoload = require(self::$file);
|
||||||
$this->assertInternalType('array', $autoload);
|
$this->assertInternalType('array', $autoload);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAutoloadArrayNotEmpty()
|
public function testAutoloadArrayNotEmpty()
|
||||||
{
|
{
|
||||||
$autoload = require(self::$file);
|
$autoload = require(self::$file);
|
||||||
$this->assertNotEmpty($autoload);
|
$this->assertNotEmpty($autoload);
|
||||||
$this->assertArrayHasKey('Action', $autoload);
|
$this->assertArrayHasKey('Action', $autoload);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAutoloadGetFilePath()
|
public function testAutoloadGetFilePath()
|
||||||
{
|
{
|
||||||
$autoload = require(self::$file);
|
$autoload = require(self::$file);
|
||||||
$this->assertNotEmpty($autoload['Registry']);
|
$this->assertNotEmpty($autoload['Registry']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @TODO: Load::getFilePath - check for wrong index
|
* @TODO: Load::getFilePath - check for wrong index
|
||||||
* @expectedException PHPUnit_Framework_Error
|
* @expectedException PHPUnit_Framework_Error
|
||||||
@ -90,23 +92,21 @@ class LoadTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testAutoloadGetFilePathNullIndex()
|
public function testAutoloadGetFilePathNullIndex()
|
||||||
{
|
{
|
||||||
$autoload = require(self::$file);
|
$autoload = require(self::$file);
|
||||||
$this->assertNotEmpty($autoload['anton']);
|
$this->assertNotEmpty($autoload['anton']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function tearDownAfterClass()
|
public static function tearDownAfterClass()
|
||||||
{
|
{
|
||||||
if(file_exists(self::$file)) {
|
if (file_exists(self::$file)) {
|
||||||
unlink(self::$file);
|
unlink(self::$file);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (self::$inc_dirs as $dir => $is_exist) {
|
foreach (self::$inc_dirs as $dir => $is_exist) {
|
||||||
if (!$is_exist) {
|
if (!$is_exist) {
|
||||||
rmdir($dir);
|
rmdir($dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rmdir(PATH . '/' . APP);
|
rmdir(PATH . '/' . APP);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
* Unit tests for Registry
|
* Unit tests for Registry
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once '../Registry.php';
|
require_once dirname(__FILE__) . '/../Registry.php';
|
||||||
|
|
||||||
class RegistryTest extends PHPUnit_Framework_TestCase
|
class RegistryTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user