diff --git a/Load.php b/Load.php index a765c2b..9312873 100644 --- a/Load.php +++ b/Load.php @@ -16,6 +16,8 @@ class Load static protected $exclude = array(); + static protected $builder = null; + /** * Add exclude path for autoload. Should be called before setAutoloadFrom * @static @@ -24,12 +26,12 @@ class Load */ static public function setExclude($exclude = array()) { - if(!is_array($exclude)) { + if (!is_array($exclude)) { $exclude = array($exclude); } self::$exclude = array_merge(self::$exclude, $exclude); } - + static public function setAutoloadFrom($file) { self::$file = $file; @@ -72,12 +74,14 @@ class Load } $scan = array(PATH . '/' . APP . '/src', PATH . '/lib'); - $exclude = array_merge(self::$exclude, array(PATH . '/.git', PATH . '/lib/core/tests', PATH . '/lib/core/.git')); + $exclude = array_merge(self::$exclude, array(PATH . '/.git', PATH . '/lib/core/tests', PATH . '/lib/core/.git')); - require_once(PATH . '/lib/core/util/AutoloadBuilder.php'); - $builder = new AutoloadBuilder(self::$file, $scan, $exclude); - $builder->build(); + if (!self::$builder) { + require_once(PATH . '/lib/core/util/AutoloadBuilder.php'); + self::$builder = new AutoloadBuilder(self::$file, $scan, $exclude); + } + self::$builder->build(); ignore_user_abort(false); } } \ No newline at end of file diff --git a/Registry.php b/Registry.php index 89fee9f..ed61adf 100644 --- a/Registry.php +++ b/Registry.php @@ -42,7 +42,7 @@ class Registry extends ArrayObject } /** - * @codeCoverageIgnoreStart + * @codeCoverageIgnoreEnd */ /** diff --git a/tests/LoadTest.php b/tests/LoadTest.php index c0a1d1a..28fe9ef 100644 --- a/tests/LoadTest.php +++ b/tests/LoadTest.php @@ -36,7 +36,6 @@ class LoadTest extends PHPUnit_Framework_TestCase /** * @TODO: Load->buildAutoload() should recieve AutoloadBuilder as a parameter - * @TODO: Load->buildAutoload() - uses two paths - PATH . '/' . APP . '/src' and PATH . '/lib' those are not checked. Can cause error. */ public function setUp() { @@ -113,7 +112,6 @@ class LoadTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess - * @TODO: Load - check if input file returns array */ public function testFileForArray() { @@ -142,7 +140,6 @@ class LoadTest extends PHPUnit_Framework_TestCase } /** - * @TODO: Load::getFilePath - check for wrong index * @runInSeparateProcess */ public function testAutoloadGetFilePathNullIndex() @@ -160,6 +157,7 @@ class LoadTest extends PHPUnit_Framework_TestCase public function testDebugAutoload() { $this->setConstants(); + unlink(self::$file); Load::setAutoloadFrom(self::$file); $autoload = require(self::$file); diff --git a/util/profiler/Profiler.php b/util/profiler/Profiler.php index 8f062fa..37db682 100644 --- a/util/profiler/Profiler.php +++ b/util/profiler/Profiler.php @@ -43,7 +43,7 @@ class Profiler } /** - * @codeCoverageIgnoreStart + * @codeCoverageIgnoreEnd */ /**