public static function initialize($with_cache = true)
 {
     $tmp_dir = sfToolkit::getTmpDir();
     if (is_readable($tmp_dir . DIRECTORY_SEPARATOR . 'sf_autoload_paths.php')) {
         self::$class_paths = unserialize(file_get_contents($tmp_dir . DIRECTORY_SEPARATOR . 'sf_autoload_paths.php'));
     } else {
         $files = pakeFinder::type('file')->name('*.class.php')->ignore_version_control()->in(realpath(dirname(__FILE__) . '/../../lib'));
         self::$class_paths = array();
         foreach ($files as $file) {
             preg_match_all('~^\\s*(?:abstract\\s+|final\\s+)?(?:class|interface)\\s+(\\w+)~mi', file_get_contents($file), $classes);
             foreach ($classes[1] as $class) {
                 self::$class_paths[$class] = $file;
             }
         }
         if ($with_cache) {
             file_put_contents($tmp_dir . DIRECTORY_SEPARATOR . 'sf_autoload_paths.php', serialize(self::$class_paths));
         }
     }
 }
Ejemplo n.º 2
0
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../lib/vendor/lime/lime.php';
$h = new lime_harness(new lime_output_color());
$h->base_dir = realpath(dirname(__FILE__) . '/..');
// cache autoload files
require_once $h->base_dir . '/bootstrap/unit.php';
testAutoloader::initialize(true);
// unit tests
$h->register_glob($h->base_dir . '/unit/*/*Test.php');
// functional tests
$h->register_glob($h->base_dir . '/functional/*Test.php');
$h->register_glob($h->base_dir . '/functional/*/*Test.php');
// other tests
$h->register_glob($h->base_dir . '/other/*Test.php');
$h->run();
testAutoloader::removeCache();
Ejemplo n.º 3
0
function __autoload($class)
{
    return testAutoloader::__autoload($class);
}