public function autoload2($class)
 {
     echo "autoload2\n";
     spl_autoload_unregister(array($this, 'autoload2'));
     spl_autoload_register(array($this, 'autoload2'));
     spl_autoload_call($class);
 }
 /**
  * Reloads the autoloader.
  * 
  * @param  string $class
  * 
  * @return boolean
  */
 public function autoload($class)
 {
     // only reload once
     if ($this->reloaded) {
         return false;
     }
     $autoloads = spl_autoload_functions();
     // as of PHP 5.2.11, spl_autoload_functions() returns the object as the first element of the array instead of the class name
     if (version_compare(PHP_VERSION, '5.2.11', '>=')) {
         foreach ($autoloads as $position => $autoload) {
             if ($this === $autoload[0]) {
                 break;
             }
         }
     } else {
         $position = array_search(array(__CLASS__, 'autoload'), $autoloads, true);
     }
     if (isset($autoloads[$position + 1])) {
         $this->unregister();
         $this->register();
         // since we're rearranged things, call the chain again
         spl_autoload_call($class);
         return class_exists($class, false) || interface_exists($class, false);
     }
     $autoload = sfAutoload::getInstance();
     $autoload->reloadClasses(true);
     $this->reloaded = true;
     return $autoload->autoload($class);
 }
 public static function autoLoadAnnotation()
 {
     if (!self::$annotationIsLoad) {
         foreach (self::$annotationList as $annotation) {
             spl_autoload_call(self::$annotationPackage . $annotation);
         }
         self::$annotationIsLoad = true;
     }
 }
 function testFunc()
 {
     $loader = new BasePathClassLoader(array('tests/lib'));
     $loader->register();
     ok($loader);
     spl_autoload_call('Foo\\Bar');
     ok(class_exists('Foo\\Bar'));
     $loader->unregister();
 }
Example #5
0
    function test()
    {
        spl_autoload_call('FormKit\\ResponseUtils');
        block_start('level-1');
        ?>
Block 1<?php 
        $content = block_end();
        is('Block 1', $content);
        $content = FormKit\Block::getContent('level-1');
        is('Block 1', $content);
    }
 public static function autoLoadAnnotation()
 {
     if (!self::$annotationIsLoad) {
         foreach (self::$annotationList as $annotation) {
             $className = self::$annotationPackage . $annotation;
             if (!class_exists($className)) {
                 spl_autoload_call($className);
             }
         }
         self::$annotationIsLoad = true;
     }
 }
Example #7
0
 protected static function registerAnnotationLoader(array $namespaces)
 {
     AnnotationRegistry::reset();
     AnnotationRegistry::registerLoader(function ($class) use($namespaces) {
         foreach ($namespaces as $namespace) {
             if (strpos($class, $namespace) === 0) {
                 spl_autoload_call($class);
                 return class_exists($class, false);
             }
         }
     });
 }
 protected function autoload($className)
 {
     echo 'No path is defined, try to autoload class...' . PHP_EOL . PHP_EOL;
     if (!class_exists($className)) {
         spl_autoload_call($className);
     }
     if (!class_exists($className)) {
         echo 'Unable to autoload the entity class(' . $className . '), try with a path' . PHP_EOL;
         return false;
     } else {
         echo 'Class is load.' . PHP_EOL;
         return true;
     }
 }
 /**
  * Loads the given class or interface.
  *
  * @param string $class The name of the class
  */
 public function loadClass($class)
 {
     if (array_key_exists($class, $aliases = $this->classAliasList->getRegisteredAliases())) {
         // we have an alias for it, but we don't have it yet loaded
         // (because after all, we're in the auto loader.)
         $fullClass = $aliases[$class];
         if (!class_exists($fullClass, false)) {
             spl_autoload_call($fullClass);
         }
         // finally, we set up a class alias for this list. We do this now because
         // we don't know earlier what namespace it'll be in
         class_alias($fullClass, $class);
     }
 }
Example #10
0
 /**
  * @static
  * @throws Exception
  *         |WeLearn_Base_LoaderNaoIniciadoException
  *         |WeLearn_Base_ParametroInvalidoException
  *         |WeLearn_DAO_DAOInvalidaException
  *         |WeLearn_DAO_DAONaoEncontradaException
  *         |WeLearn_DAO_CFNaoDefinidaException
  * @param string $nomeDao Nome da classe DAO
  * @param array|null $opcoes Opções que serão passadas como parâmetro
  *                           na inicialização da classe DAO e sua Column Family
  * @param boolean $DaoPadrao Indicador se a DAO à ser carregada extende a DAO padrão ou não.
  *
  * @return mixed
  */
 public static function create($nomeDao, array $opcoes = null, $DaoPadrao = true)
 {
     //Criação de DAO não funciona se o autoload não estiver iniciado
     if (!WeLearn_Base_AutoLoader::hasInitiated()) {
         throw new WeLearn_Base_LoaderNaoIniciadoException();
     }
     if (is_string($nomeDao) && $nomeDao !== '') {
         $classeDAO = $nomeDao;
     } elseif (is_object($nomeDao) && is_subclass_of($nomeDao, 'WeLearn_DTO_IDTO')) {
         $nsSseparator = WeLearn_Base_Loader::getInstance()->getNamespaceSeparator();
         $classeComNamespace = explode($nsSseparator, get_class($nomeDao));
         //Ultimo elemento do array é o nome da classe
         $classeSomenteNome = $classeComNamespace[count($classeComNamespace) - 1];
         $classeDAO = $classeSomenteNome . 'DAO';
     } else {
         throw new WeLearn_Base_ParametroInvalidoException();
     }
     //Se a classe não foi definida
     if (!class_exists($classeDAO)) {
         spl_autoload_call($classeDAO);
         //Tenta carregar
         //Se ainda não estiver sido definida
         if (!class_exists($classeDAO)) {
             throw new WeLearn_DAO_DAONaoEncontradaException($classeDAO);
         }
     }
     //Se foi definida mas não extende a classe DAO padrão
     if ($DaoPadrao && !is_subclass_of($classeDAO, 'WeLearn_DAO_AbstractDAO')) {
         throw new WeLearn_DAO_DAOInvalidaException($classeDAO);
     }
     if ($DaoPadrao && !$classeDAO::isSingletonInstanciado()) {
         $DAOObject = $classeDAO::getInstanciaSingleton();
         //Se o nome da Column Family da DAO não foi definido, não continua
         if (is_null($DAOObject->getNomeCF())) {
             throw new WeLearn_DAO_CFNaoDefinidaException($classeDAO);
         }
         //Rotina para criar o objeto que representa a Column Family (pode ser modificado)
         $CF = WL_Phpcassa::getInstance()->getColumnFamily($DAOObject->getNomeCF(), $opcoes);
         $DAOObject->setCF($CF);
     } elseif ($DaoPadrao) {
         $DAOObject = $classeDAO::getInstanciaSingleton();
     } else {
         $DAOObject = new $classeDAO();
     }
     return $DAOObject;
 }
Example #11
0
 /**
  * Aliases concrete5 classes to shorter class name aliases
  *
  * IDEs will not recognize these classes by default. A symbols file can be generated to
  * assist IDEs by running SymbolGenerator::render() via PHP or executing the command-line
  * 'concrete/bin/concrete5 c5:ide-symbols
  */
 protected function setupAliasAutoloader()
 {
     $loader = $this;
     spl_autoload_register(function ($class) use($loader) {
         $list = ClassAliasList::getInstance();
         if (array_key_exists($class, $aliases = $list->getRegisteredAliases())) {
             // we have an alias for it, but we don't have it yet loaded
             // (because after all, we're in the auto loader.)
             $fullClass = $aliases[$class];
             if (!class_exists($fullClass, false)) {
                 spl_autoload_call($fullClass);
             }
             // finally, we set up a class alias for this list. We do this now because
             // we don't know earlier what namespace it'll be in
             class_alias($fullClass, $class);
         }
     });
 }
Example #12
0
 public function __call($method, $args)
 {
     /* check registered operations */
     if (isset($this->registered[$method])) {
         $operation = $this->registered[$method];
         return call_user_func_array(array($operation, 'run'), $args);
     }
     $class = '\\GenPHP\\Operation\\' . ucfirst($method) . 'Operation';
     if (!class_exists($class)) {
         spl_autoload_call($class);
     }
     if (class_exists($class)) {
         $operation = new $class($this->self);
         return call_user_func_array(array($operation, 'run'), $args);
     } else {
         throw new Exception("Operation class not found: {$class}");
     }
 }
Example #13
0
 public static function load_library($library)
 {
     // Primeiramente é necessário identificar se é uma classe no próprio módulo
     // Para isto, o objeto deve iniciar com duplo underline
     // Exemplo: __exemplo passará a ser site_exemplo_library
     if (substr($library, 0, 2) === '__') {
         // Se for, a informação é substituida pelo módulo
         $library = join('_', core::get_caller_module_path()) . '_' . substr($library, 2);
     }
     // Anexa o sulfixo das bibliotecas
     $library .= '_library';
     // Se a classe já tiver sido carregada, evita o processo
     if (isset(self::$_loaded_classes[$library])) {
         return $library;
     }
     // Agora, é necessário carregar tal classe
     spl_autoload_call($library);
     // Salva em loaded classes e retorna
     self::$_loaded_classes[$library] = true;
     return $library;
 }
Example #14
0
 /** Returns a checker or a converter for the given type.  First checks for
 	    one explicitly defined for the type, then attempts to load the class
 	    specified by the type hint and checks again for an explicitly defined -er
 	    for the type, then looks for a wildcard typehint defined to an enclosing
 	    namespace if the type is namespaced, then finally gives up and returns
 	    null.
 
 	    The class load is so classes can self-register type hints, rather than
 	    needing to maintain them all in this (or a specifically included) file,
 	    which could easily become unweildy.  Note however that merely autoloading
 	    a subclass does not trip the autoloader for a parent class, and thus you
 	    cannot rely on tripping the autoloader for wildcard typehints. */
 protected function getErForType($kind, $type)
 {
     $array = $this->{"{$kind}ers"};
     if (isset($array[$type])) {
         return $array[$type];
     }
     // No explicit handler, trip the autoloader machinery then look for an
     // explicit -er again
     if (!class_exists($type, false) && !interface_exists($type, false) && !trait_exists($type, false)) {
         spl_autoload_call($type);
         if (isset($array[$type])) {
             return $array[$type];
         }
     }
     // Check for a whole-namespace -er
     $namespaces = explode('\\', $type);
     while (array_pop($namespaces) && count($namespaces)) {
         $wildns = join('\\', $namespaces) . '\\*';
         if (isset($array[$wildns])) {
             return $array[$wildns];
         }
     }
     return null;
 }
Example #15
0
 public function sanitize(&$data)
 {
     // manually trigger autoloading, as it's not done in some edge cases due to PHP bugs (see #60149)
     if (!class_exists('Raven_Serializer')) {
         spl_autoload_call('Raven_Serializer');
     }
     $data = Raven_Serializer::serialize($data);
 }
Example #16
0
 /**
  * Autoloader.
  *
  * @param   string  $classname    Classname.
  * @return  bool
  */
 public static function autoload($classname)
 {
     if (false === strpos($classname, '\\')) {
         return false;
     }
     $classname = ltrim($classname, '\\');
     // Hard-preload.
     if ('Hoa\\Core' === substr($classname, 0, 8) && false !== ($pos = strpos($classname, '\\', 10)) && 'Bin\\' !== substr($classname, 9, 4)) {
         require static::$_class[substr($classname, 0, $pos)]['path'];
         return true;
     }
     $head = substr($classname, 0, strpos($classname, '\\'));
     if (false === array_key_exists($classname, static::$_class)) {
         $_classname = str_replace('\\', '.', $classname);
         $out = from($head)->_import($_classname, true);
         if (false === static::entityExists($classname)) {
             $out = from($head)->_import($_classname . '.~', true);
         }
         return $out;
     } elseif (is_string($original = static::$_class[$classname])) {
         spl_autoload_call($original);
         return true;
     }
     $roots = from($head)->getRoot();
     $classpath = str_replace('\\', DS, $classname) . '.php';
     $classpathExtended = str_replace('\\', DS, $classname . substr($classname, strrpos('\\', $classname, 1))) . '.php';
     $gotcha = false;
     foreach ($roots as $vendor => $_roots) {
         foreach ($_roots as $root) {
             if (true === file_exists($path = $root . $classpath) || true === file_exists($path = $root . $classpathExtended)) {
                 $gotcha = true;
                 require $path;
                 static::$_class[$classname]['path'] = $path;
                 break 2;
             }
         }
     }
     return $gotcha;
 }
Example #17
0
 /**
  * Dynamic new, a simple factory.
  * It loads and constructs a class, with provided arguments.
  *
  * @param   bool     $classname    Classname.
  * @param   array    $arguments    Arguments for the constructor.
  * @return  object
  */
 public static function dnew($classname, array $arguments = [])
 {
     $classname = ltrim($classname, '\\');
     if (false === Consistency::entityExists($classname, false)) {
         spl_autoload_call($classname);
     }
     $class = new \ReflectionClass($classname);
     if (empty($arguments) || false === $class->hasMethod('__construct')) {
         return $class->newInstance();
     }
     return $class->newInstanceArgs($arguments);
 }
Example #18
0
 function __autoload($ClassName)
 {
     trigger_error('__autoload() is deprecated. Use sp_autoload_call() instead.', E_USER_DEPRECATED);
     spl_autoload_call($ClassName);
 }
 /**
  * Register this instance as an auto loader.
  *
  * @param bool $prepend Whether to prepend the autoloader or not.
  *
  * @return void
  */
 public function register($prepend = false)
 {
     // Just to make sure we have them loaded.
     spl_autoload_call('PhpCodeQuality\\AutoloadValidation\\Exception\\ClassNotFoundException');
     spl_autoload_call('PhpCodeQuality\\AutoloadValidation\\Exception\\ParentClassNotFoundException');
     $this->previousLoaders = spl_autoload_functions();
     foreach ($this->previousLoaders as $previousLoader) {
         spl_autoload_unregister($previousLoader);
     }
     spl_autoload_register(array($this, 'loadClass'), true, $prepend);
 }
 public function capture($data, $stack = null, $vars = null)
 {
     if (!isset($data['timestamp'])) {
         $data['timestamp'] = gmdate('Y-m-d\\TH:i:s\\Z');
     }
     if (!isset($data['level'])) {
         $data['level'] = self::ERROR;
     }
     if (!isset($data['tags'])) {
         $data['tags'] = array();
     }
     if (!isset($data['extra'])) {
         $data['extra'] = array();
     }
     if (!isset($data['event_id'])) {
         $data['event_id'] = $this->uuid4();
     }
     if (isset($data['message'])) {
         $data['message'] = substr($data['message'], 0, $this->message_limit);
     }
     $data = array_merge($this->get_default_data(), $data);
     if ($this->is_http_request()) {
         $data = array_merge($this->get_http_data(), $data);
     }
     $data = array_merge($this->get_user_data(), $data);
     if ($this->release) {
         $data['release'] = $this->release;
     }
     if ($this->environment) {
         $data['environment'] = $this->environment;
     }
     $data['tags'] = array_merge($this->tags, $this->context->tags, $data['tags']);
     $data['extra'] = array_merge($this->get_extra_data(), $this->context->extra, $data['extra']);
     if (empty($data['extra'])) {
         unset($data['extra']);
     } else {
         $data['extra'] = $data['extra'];
     }
     if (empty($data['tags'])) {
         unset($data['tags']);
     } else {
         $data['tags'] = $data['tags'];
     }
     if (!empty($data['user'])) {
         $data['user'] = $data['user'];
     }
     if (!empty($data['request'])) {
         $data['request'] = $data['request'];
     }
     if (!$this->breadcrumbs->is_empty()) {
         $data['breadcrumbs'] = $this->breadcrumbs->fetch();
     }
     if (!$stack && $this->auto_log_stacks || $stack === true) {
         $stack = debug_backtrace();
         // Drop last stack
         array_shift($stack);
     }
     if (!empty($stack)) {
         // manually trigger autoloading, as it's not done in some edge cases due to PHP bugs (see #60149)
         if (!class_exists('Raven_Stacktrace')) {
             spl_autoload_call('Raven_Stacktrace');
         }
         if (!isset($data['stacktrace']) && !isset($data['exception'])) {
             $data['stacktrace'] = array('frames' => Raven_Stacktrace::get_stack_info($stack, $this->trace, $this->shift_vars, $vars, $this->message_limit, $this->prefixes, $this->app_path));
         }
     }
     $this->sanitize($data);
     $this->process($data);
     if (!$this->store_errors_for_bulk_send) {
         $this->send($data);
     } else {
         if (empty($this->error_data)) {
             $this->error_data = array();
         }
         $this->error_data[] = $data;
     }
     $this->_last_event_id = $data['event_id'];
     return $data['event_id'];
 }
Example #21
0
 public function sanitize(&$data)
 {
     $app = app();
     $config = $app->make('config');
     $files = $app->make('files');
     // manually trigger autoloading, as it's not done in some edge cases due to PHP bugs (see #60149)
     if (!class_exists('Raven_Serializer')) {
         spl_autoload_call('Raven_Serializer');
     }
     // get keys variables environment file
     $configEnv = $config->getEnvironment();
     if ($configEnv == 'production') {
         $envFile = '.env.php';
     } else {
         $envFile = '.env.' . $configEnv . '.php';
     }
     $envFileComplete = base_path() . '/' . $envFile;
     if ($files->exists($envFileComplete)) {
         $envKeys = array_keys($files->getRequire($envFileComplete));
         // remove variables environment file in data send to sentry
         if (isset($data['sentry.interfaces.Http']['env']) && is_array($data['sentry.interfaces.Http']['env'])) {
             foreach ($data['sentry.interfaces.Http']['env'] as $key => $value) {
                 if (in_array($key, $envKeys)) {
                     unset($data['sentry.interfaces.Http']['env'][$key]);
                 }
             }
         }
     }
     $data = Raven_Serializer::serialize($data);
 }
Example #22
0
    </form>
</div>
    <div class="col-lg-4  col-mg-6 col-sm-12">
    <form action="action.php" method="post">
        <div class="input-group-sm">
            <input class="input-group" type="text" name="txt">
            <button class="btn btn-sm btn-secondary-outline" type="submit">&#9</button>
        </div>
    </form>
    </div><div class="col-lg-4  col-mg-6 col-sm-12">
    <form action="action.php" method="post">
        <div class="input-group-sm">
            <?php 
include_once 'action.php';
echo MyFunc(12, 34);
spl_autoload_call('MyClass');
$obj1 = new MyClass();
echo $obj1->MyClassfunc();
print "\n";
?>
        </div>
    </form>
    </div>
    <div class="col-lg-pull-6 col-lg6 col-md-4 col-sm-12">
        <div class="card-block card-blockquote">
            <div class="card">
                <img class="card-img " src="images/">
                <p class="card-header">Заголовок</p>
                <p class="card-text">Текст расположенный на карте</p>
                <button class="btn btn-success-outline card-success-outline">Отправить</button>
            </div>
Example #23
0
 public static function init()
 {
     Once::exec(__FILE__ . '::init', function () {
         @header('Infrajs-Config-All: false');
         require_once 'vendor/infrajs/path/Path.php';
         spl_autoload_register(function ($class_name) {
             $p = explode('\\', $class_name);
             if (sizeof($p) < 3) {
                 return;
             }
             //Ищем имя расширения по переданному полному адресу до Класса
             //Ситуация с именем расширения
             //infrajs/path/Path - path
             //infrajs/path/src/URN - path
             //infrajs/config/search/Search - config-search Search
             //infrajs/config/search/Search - config search/Search
             //infrajs/config/Search - config src/Search
             //path/Path - path
             //path/src/URN - path
             //config/search/Search - config-search
             $vendor = array_shift($p);
             $class = array_pop($p);
             $name = implode('-', $p);
             while (!Path::theme('-' . $name . '/') && sizeof($p) > 1) {
                 array_pop($p);
                 $name = implode('-', $p);
             }
             if (!empty(Config::$exec[$name])) {
                 return;
             }
             if (!Path::theme('-' . $name . '/')) {
                 return;
             }
             Config::$exec[$name] = true;
             spl_autoload_call($class_name);
             Config::get($name);
             // <- Всё ради автоматического этого
         }, true, true);
         //set_error_handler( function () { //bugfix
         //	ini_set('display_errors', true);
         //});
         Config::add('conf', function ($name, $value, &$conf) {
             $valconf = $value::$conf;
             foreach ($conf as $k => $v) {
                 $valconf[$k] = $v;
             }
             //merge нужно делать с сохранением ключей, даже для числовых ключей
             $conf = $valconf;
             //$conf=array_merge($value::$conf, $conf); //Второй массив важнее его значения остаются
             $value::$conf =& $conf;
         });
         Config::add('clutch', function ($name, $value, &$conf) {
             //Имя расширения в котором найдено свойство, значение, весь конфиг того расширения
             //$dir = Path::theme('-'.$name.'/');
             foreach ($value as $plugin => $paths) {
                 Each::exec($paths, function &($dir) use($plugin, &$conf) {
                     if (empty(Path::$conf['clutch'][$plugin])) {
                         Path::$conf['clutch'][$plugin] = [];
                     }
                     if (!in_array($dir, Path::$conf['clutch'][$plugin])) {
                         Path::$conf['clutch'][$plugin][] = $dir;
                     }
                     Config::load($dir . $plugin . '/.infra.json', $plugin);
                     $r = null;
                     return $r;
                 });
             }
             //Path::$conf['clutch'][] = $value;
         });
         Config::load('.infra.json');
         Config::load('~.infra.json');
         //Конфиг в кэш папке генерируется автоматически это единственный способ попасть в стартовую обраотку нового расширения. Для clutch
         Config::load('!.infra.json');
         Config::get('path');
         Config::get('config');
         Config::get('each');
         Config::get('hash');
         Config::get('once');
         Config::get('load');
         Config::get('ans');
         /* 
         	echo '<pre>';
         	print_r(get_declared_classes());
         	exit;
         	Debug проврить классы каких расширений после композера загружены и в ручную инициализировать их конфиги
             [132] => infrajs\config\Config
         	[133] => infrajs\once\Once
         	[134] => infrajs\hash\Hash
         	[135] => infrajs\path\Path
         	[136] => infrajs\load\Load
         	[137] => infrajs\each\Each
         	[138] => infrajs\ans\Ans
         */
     });
 }
 /**
  * Prepare the Version 1.0 compatible Contao class loader hack.
  *
  * @return void
  *
  * @deprecated Deprecated since 1.1, to be removed in 2.0 - use custom hacks instead.
  */
 public function prepareLegacyHack()
 {
     $logger = $this->logger;
     // Add Contao hack.
     $this->enumLoader->add(function ($class) use($logger) {
         if (substr($class, 0, 7) !== 'Contao\\') {
             try {
                 spl_autoload_call('Contao\\' . $class);
             } catch (ParentClassNotFoundException $exception) {
                 return null;
             }
             if (EnumeratingClassLoader::isLoaded('Contao\\' . $class) && !EnumeratingClassLoader::isLoaded($class)) {
                 class_alias('Contao\\' . $class, $class);
                 $logger->warning('Loaded class {class} as {alias} from deprecated Contao hack. ' . 'Please specify a custom loader hack if you want to keep this class loaded.', array('class' => 'Contao\\' . $class, 'alias' => $class));
                 return true;
             }
         }
         return null;
     }, 'contao.hack');
 }
<?php

if (false === spl_autoload_functions()) {
    if (function_exists('__autoload')) {
        spl_autoload_register('__autoload', false);
    }
}
// 尝试加载className.php
if (spl_autoload_call('className') && class_exists('className', false)) {
    echo 'className was loaded';
    // 安全地实例化className类
    $instance = new className();
} else {
    // 在这里实例化className类是不安全的
    echo 'className was not found';
}
Example #26
0
spl_autoload_extensions('.php,.inc,.class,.interface');
function myLoader1($class)
{
    $class = strtolower($class);
    if (file_exists('1/' . $class . '.class.php')) {
        require_once "1/" . $class . ".class.php";
    }
}
function myLoader2($class)
{
    $class = strtolower($class);
    if (file_exists('2/' . $class . ".php")) {
        require_once "2/" . $class . ".php";
    }
}
if (false === spl_autoload_functions()) {
    if (function_exists('__autoload')) {
        spl_autoload_register('__autoload', false);
    }
}
spl_autoload_register('myLoader1', true);
spl_autoload_register('myLoader2', true);
var_dump(spl_autoload_call('SomeClass'));
//试着call这个定义类
var_dump(class_exists('SomeClass', false));
if (class_exists('SomeClass', false)) {
    echo 'SomeClass was loaded.';
    $instance = new SomeClass();
} else {
    echo 'SomeClass was not found';
}
 /**
  * @requires PHP 5.4
  */
 public function testTraits()
 {
     spl_autoload_call('SebastianBergmann\\GlobalState\\TestFixture\\SnapshotTrait');
     $snapshot = new Snapshot($this->getBlacklist(), false, false, false, false, false, false, true, false, false);
     $this->assertContains('SebastianBergmann\\GlobalState\\TestFixture\\SnapshotTrait', $snapshot->traits());
 }
Example #28
0
 /**
  * Prepares the testing environment.
  */
 protected function setUp()
 {
     // Loads required classes
     spl_autoload_call('\\Jyxo\\Beholder\\TestCase');
     spl_autoload_call('\\Jyxo\\Beholder\\Result');
 }
Example #29
0
 /**
  * Add class and file name to the list.
  * @param  string
  * @param  string
  * @param  int
  * @return void
  */
 private function addClass($class, $file, $time)
 {
     $class = strtolower($class);
     if (!empty($this->list[$class]) && $this->list[$class][0] !== $file) {
         spl_autoload_call($class);
         // hack: enables exceptions
         throw new \InvalidStateException("Ambiguous class '{$class}' resolution; defined in {$file} and in " . $this->list[$class][0] . ".");
     }
     $this->list[$class] = array($file, $time);
 }
Example #30
0
 function addClass($class, $file)
 {
     $class = strtolower($class);
     if (!empty($this->list[$class]) && $this->list[$class] !== $file) {
         spl_autoload_call($class);
         throw new InvalidStateException("Ambiguous class '{$class}' resolution; defined in {$file} and in " . $this->list[$class] . ".");
     }
     $this->list[$class] = $file;
 }