public function testUseIncludePath()
 {
     $loader = new UniversalClassLoader();
     $this->assertFalse($loader->getUseIncludePath());
     $this->assertNull($loader->findFile('Foo'));
     $includePath = get_include_path();
     $loader->useIncludePath(true);
     $this->assertTrue($loader->getUseIncludePath());
     set_include_path(__DIR__ . '/Fixtures/includepath' . PATH_SEPARATOR . $includePath);
     $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'includepath' . DIRECTORY_SEPARATOR . 'Foo.php', $loader->findFile('Foo'));
     set_include_path($includePath);
 }
Esempio n. 2
0
<?php

require_once __DIR__ . '/../vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php';
require_once __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
// You can search the include_path as a last resort.
$loader->useIncludePath(true);
// ... register namespaces and prefixes here - see below
$loader->registerNamespaces(array('SagePHP' => __DIR__ . '/../src/'));
$loader->register();
Esempio n. 3
0
    array_pop($urlParts);
    return implode('/', $urlParts) . '/';
}
if (get_magic_quotes_gpc()) {
    throw new Exception("magic_quotes_gpc is not supported");
}
/******************************************************************************
 * Constants
 *****************************************************************************/
define('ROOT_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
define('ROOT_URL', get_base_url());
ini_set("include_path", ROOT_PATH . 'libs' . DIRECTORY_SEPARATOR);
$loader = (require_once ROOT_PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
use Symfony\Component\ClassLoader\UniversalClassLoader;
$universalLoader = new UniversalClassLoader();
$universalLoader->useIncludePath(true);
$universalLoader->register();
require_once 'Zend/Db/Adapter/Mysqli.php';
/******************************************************************************
 * Loading of the options (default & user)
 *****************************************************************************/
if (!file_exists(ROOT_PATH . "options.php")) {
    die("The file options.php should exists, please read the instructions inside of 'options.php-example'.");
}
require_once ROOT_PATH . "options_default.php";
require_once ROOT_PATH . "options.php";
/******************************************************************************
 * Initialize all the global variables
 *****************************************************************************/
require_once ROOT_PATH . '/services.php';
$g_database = new Zend_Db_Adapter_Mysqli($g_options['mysql']);