Example #1
0
 /**
  * Asserts that Autoloader::buildIndex() stores all class definitions
  * in its index
  *
  * @param Autoloader $autoloader    The tested Autoloader instance
  * @param Array      $expectedPaths A list of all class definitions
  *
  * @dataProvider provideTestBuildIndex
  * @see Autoloader::buildIndex()
  * @return void
  */
 public function testBuildIndex(Autoloader $autoloader, array $expectedPaths)
 {
     $autoloader->buildIndex();
     $foundPaths = $autoloader->getIndex()->getPaths();
     ksort($foundPaths);
     ksort($expectedPaths);
     $this->assertEquals($expectedPaths, $foundPaths);
 }
Example #2
0
 * setup autoloader
 */
require_once PATH_DEPENDING . "classes/autoloader/Autoloader.php";
Autoloader::getRegisteredAutoloader()->remove();
$autoloaderIndexFile = PATH_TEMP . "koala_autoloader.gz";
if (DEVELOPMENT_MODE && browserNoCache() && !isAjaxRequest() && !isPhpCli()) {
    if (file_exists($autoloaderIndexFile)) {
        unlink($autoloaderIndexFile);
    }
}
if (dropCache() && !isAjaxRequest()) {
    emptyCacheFolder();
}
$autoloader = new Autoloader(PATH_BASE);
$autoloader->register();
$autoloader->getIndex()->setIndexPath($autoloaderIndexFile);
$autoloader->getFileIterator()->setOnlyDirPattern("~/((core)|(depending)|(extensions))~");
$autoloader->getFileIterator()->setOnlyFilePattern("~\\.php\$~i");
$autoloader->getFileIterator()->addSkipDirPattern("~/((javascript)|(\\.settings)|(\\.todo)|(cache)|(log)|(temp))~");
$autoloader->getFileIterator()->addSkipFilePattern("~/\\.~");
if (apache_getenv("AUTOLOADER_BUILD_RUNNING")) {
    die("System Initialisation is running. Please wait.");
}
if (!file_exists($autoloaderIndexFile)) {
    displayStartupUserInfo();
    try {
        apache_setenv("AUTOLOADER_BUILD_RUNNING", true);
        $autoloader->buildIndex();
        apache_setenv("AUTOLOADER_BUILD_RUNNING", false);
    } catch (AutoloaderException $e) {
        if ($e instanceof AutoloaderException_Parser_IO) {
Example #3
0
<?php

error_reporting((E_ALL | E_NOTICE) & ~E_DEPRECATED);
define("PATH_ROOT", "/Volumes/Users/Entwicklung/php/workspace/koala-2_1/classes/");
define("PATH_UNITTEST", "/Volumes/Users/Entwicklung/php/workspace/koala-2_1/classes/PHPsTeam/unittest/");
/*require(PATH_ROOT . 'Autoloader.class.php');
Autoloader::setCacheFilePath(PATH_ROOT . '../temp/class_path_cache.txt');
Autoloader::excludeFolderNamesMatchingRegex('/^CVS|\..*$/');
Autoloader::setClassPaths(array(
    PATH_ROOT . "PHPsTeam/"
));
spl_autoload_register(array('Autoloader', 'loadClass'));*/
require PATH_ROOT . "autoloader/Autoloader.php";
Autoloader::getRegisteredAutoloader()->remove();
$autoloader = new Autoloader(PATH_ROOT);
$autoloader->register();
$autoloader->getIndex()->setIndexPath(PATH_ROOT . "../temp/phpsteam_unittest_autoloader.gz");
require_once 'classes/autorun.php';
//require_once PATH_UNITTEST . 'classes/simpletest.php';
//require_once PATH_UNITTEST . 'inc/showpasses.class.php';
SimpleTest::prefer(new showpasses());
class PHPsTeam_TestSuite extends TestSuite
{
    function PHPsTeam_TestSuite()
    {
        $this->TestSuite("all PHPsTeam unit tests");
        $this->addFile(PATH_UNITTEST . "steam_connector_test.class.php");
        $this->addFile(PATH_UNITTEST . "steam_factory_test.class.php");
        $this->addFile(PATH_UNITTEST . "steam_document_test.class.php");
    }
}