示例#1
0
<?php

/**
 * Copyright Zikula Foundation 2009 - Zikula Application Framework
 *
 * This work is contributed to the Zikula Foundation under one or more
 * Contributor Agreements and licensed to You under the following license:
 *
 * @license GNU/LGPLv3 (or at your option, any later version).
 * @package Zikula
 *
 * Please see the NOTICE file distributed with this source code for further
 * information regarding copyright and licensing.
 */
if (!defined('HTMLPURIFIER_PREFIX')) {
    define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/vendor/htmlpurifier'));
}
if (!defined('PHPIDS_PATH_PREFIX')) {
    define('PHPIDS_PATH_PREFIX', realpath(dirname(__FILE__) . '/vendor/IDS'));
}
// include the PHPIDS and get access to the result object
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/vendor'));
$autoloader = new Symfony\Component\ClassLoader\UniversalClassLoader();
$autoloader->register();
$autoloader->registerPrefixes(array('HTMLPurifier' => realpath(dirname(__FILE__) . '/vendor/htmlpurifier'), 'IDS' => realpath(dirname(__FILE__) . '/vendor')));
// register event handlers
EventUtil::attachEventHandler('SecurityCenterModule\\Listener\\FilterListener');
if (!class_exists('PHPUnit_Framework_TestCase') || version_compare(PHPUnit_Runner_Version::id(), '3.5') < 0) {
    die('PHPUnit framework is required, at least 3.5 version');
}
if (!class_exists('PHPUnit_Framework_MockObject_MockBuilder')) {
    die('PHPUnit MockObject plugin is required, at least 1.0.8 version');
}
define('TESTS_PATH', __DIR__);
define('VENDOR_PATH', realpath(__DIR__ . '/../vendor'));
$classLoaderFile = VENDOR_PATH . '/Symfony/Component/ClassLoader/UniversalClassLoader.php';
if (!file_exists($classLoaderFile)) {
    die('cannot find vendor, run: php bin/vendors.php');
}
require_once $classLoaderFile;
$loader = new Symfony\Component\ClassLoader\UniversalClassLoader();
$loader->registerNamespaces(array('Symfony' => VENDOR_PATH, 'Doctrine\\Common' => VENDOR_PATH . '/doctrine-common/lib', 'Doctrine\\Common\\DataFixtures' => VENDOR_PATH . '/doctrine-data-fixtures/lib', 'Doctrine\\DBAL' => VENDOR_PATH . '/doctrine-dbal/lib', 'Doctrine\\ORM' => VENDOR_PATH . '/doctrine-orm/lib', 'Mockery' => VENDOR_PATH . '/Mockery/library', 'Khepin' => __DIR__));
$loader->registerPrefixes(array('Mockery' => VENDOR_PATH . '/Mockery/library'));
$loader->register();
spl_autoload_register(function ($class) {
    if (0 === strpos($class, 'Khepin\\YamlFixturesBundle\\')) {
        $path = __DIR__ . '/../' . implode('/', array_slice(explode('\\', $class), 2)) . '.php';
        if (!stream_resolve_include_path($path)) {
            return false;
        }
        require_once $path;
        return true;
    }
});
Doctrine\Common\Annotations\AnnotationRegistry::registerFile(VENDOR_PATH . '/doctrine-orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$reader = new \Doctrine\Common\Annotations\CachedReader($reader, new \Doctrine\Common\Cache\ArrayCache());
$_ENV['annotation_reader'] = $reader;