Beispiel #1
0
<?php

use YapepBase\Autoloader\AutoloaderRegistry;
use YapepBase\Autoloader\SimpleAutoloader;
require __DIR__ . '/../vendor/autoload.php';
// Set up the autoloader
$autoLoader = new SimpleAutoloader();
$autoLoader->addClassPath(realpath(__DIR__ . '/../src/'));
$autoLoader->addClassPath(realpath(__DIR__));
AutoloaderRegistry::getInstance()->addAutoloader($autoLoader);
// Clean up the global namespace
unset($autoLoader);
 /**
  * Includes a file which should contain the class.
  *
  * @param string $fileName    Name of the file.
  * @param string $className   Name of the class to search for in the file.
  *
  * @return bool   TRUE if the file exists, and can be opened and contains the given class or interface.
  */
 public function loadClass($fileName, $className)
 {
     return parent::loadClass($fileName, $className);
 }
Beispiel #3
0
<?php

/**
 * This file is part of YAPEPBase.
 *
 * @package      YapepBase
 * @copyright    2011 The YAPEP Project All rights reserved.
 * @license      http://www.opensource.org/licenses/bsd-license.php BSD License
 */
use YapepBase\Autoloader\SimpleAutoloader;
use YapepBase\Autoloader\AutoloaderRegistry;
include_once __DIR__ . '/../bootstrap.php';
define('TEST_DIR', __DIR__);
\YapepBase\Application::getInstance()->getDiContainer()->getErrorHandlerRegistry()->addErrorHandler(new \YapepBase\ErrorHandler\ExceptionCreatorErrorHandler());
$autoloadDirs = (require realpath(__DIR__ . '/../vendor/composer/autoload_namespaces.php'));
// Autoloader setup
$autoloader = new SimpleAutoloader();
if (defined('APP_ROOT')) {
    $autoloader->addClassPath(APP_ROOT . '/class');
}
$autoloader->addClassPath(TEST_DIR);
foreach ($autoloadDirs as $dir) {
    $autoloader->addClassPath($dir);
}
AutoloaderRegistry::getInstance()->addAutoloader($autoloader);
unset($autoloader);