Changeset 23205
- Timestamp:
- 10/20/09 15:20:17 (4 years ago)
- Files:
-
- branches/1.3/lib/autoload/sfAutoload.class.php (modified) (2 diffs)
- branches/1.3/lib/autoload/sfCoreAutoload.class.php (modified) (1 diff)
- branches/1.3/lib/autoload/sfSimpleAutoload.class.php (modified) (3 diffs)
- branches/1.3/lib/config/sfPluginConfiguration.class.php (modified) (1 diff)
- branches/1.3/lib/task/generator/skeleton/project/test/bootstrap/unit.php (modified) (2 diffs)
- branches/1.3/lib/task/project/upgrade1.3/sfTestsUpgrade.class.php (added)
- branches/1.3/lib/task/sfBaseTask.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.3/lib/autoload/sfAutoload.class.php
r20867 r23205 74 74 } 75 75 76 /** 77 * Sets the path for a particular class. 78 * 79 * @param string $class A PHP class name 80 * @param string $path An absolute path 81 */ 76 82 public function setClassPath($class, $path) 77 83 { … … 83 89 } 84 90 91 /** 92 * Returns the path where a particular class can be found. 93 * 94 * @param string $class A PHP class name 95 * 96 * @return string|null An absolute path 97 */ 85 98 public function getClassPath($class) 86 99 { branches/1.3/lib/autoload/sfCoreAutoload.class.php
r23200 r23205 410 410 'sfpropelupgrade' => 'task/project/upgrade1.3/sfPropelUpgrade.class.php', 411 411 'sftasksupgrade' => 'task/project/upgrade1.3/sfTasksUpgrade.class.php', 412 'sftestsupgrade' => 'task/project/upgrade1.3/sfTestsUpgrade.class.php', 412 413 'sfupgrade' => 'task/project/upgrade1.3/sfUpgrade.class.php', 413 414 'sfyamlupgrade' => 'task/project/upgrade1.3/sfYamlUpgrade.class.php', branches/1.3/lib/autoload/sfSimpleAutoload.class.php
r23063 r23205 100 100 101 101 /** 102 * Returns true if sfSimpleAutoload is registered as an autoloader.103 */104 static public function isRegistered()105 {106 return self::$registered;107 }108 109 /**110 102 * Handles autoloading of classes. 111 103 * … … 317 309 } 318 310 311 /** 312 * Returns the path where a particular class can be found. 313 * 314 * @param string $class A PHP class name 315 * 316 * @return string|null An absolute path 317 */ 319 318 public function getClassPath($class) 320 319 { … … 323 322 return isset($this->classes[$class]) ? $this->classes[$class] : null; 324 323 } 324 325 /** 326 * Loads configuration from the supplied files. 327 * 328 * @param array $files An array of autoload.yml files 329 * 330 * @see sfAutoloadConfigHandler 331 */ 332 public function loadConfiguration(array $files) 333 { 334 $config = new sfAutoloadConfigHandler(); 335 foreach ($config->evaluate($files) as $class => $file) 336 { 337 $this->setClassPath($class, $file); 338 } 339 } 325 340 } branches/1.3/lib/config/sfPluginConfiguration.class.php
r23060 r23205 114 114 { 115 115 $this->configuration->getEventDispatcher()->connect('autoload.filter_config', array($this, 'filterAutoloadConfig')); 116 117 $config = new sfAutoloadConfigHandler(); 118 $mappings = $config->evaluate(array($file)); 119 120 foreach ($mappings as $class => $file) 121 { 122 $autoload->setClassPath($class, $file); 123 } 116 $autoload->loadConfiguration(array($file)); 124 117 } 125 118 else branches/1.3/lib/task/generator/skeleton/project/test/bootstrap/unit.php
r14688 r23205 3 3 /* 4 4 * This file is part of the symfony package. 5 * (c) 2004-2006Fabien Potencier <fabien.potencier@symfony-project.com>5 * (c) Fabien Potencier <fabien.potencier@symfony-project.com> 6 6 * 7 7 * For the full copyright and license information, please view the LICENSE … … 11 11 $_test_dir = realpath(dirname(__FILE__).'/..'); 12 12 13 // configuration 13 14 require_once dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'; 15 $configuration = ProjectConfiguration::hasActive() ? ProjectConfiguration::getActive() : new ProjectConfiguration(realpath($_test_dir.'/..')); 14 16 15 if (ProjectConfiguration::hasActive()) 16 { 17 $configuration = ProjectConfiguration::getActive(); 18 } 19 else 20 { 21 $configuration = new ProjectConfiguration(realpath($_test_dir.'/..')); 22 } 17 // autoloader 18 $autoload = sfSimpleAutoload::getInstance(sfConfig::get('sf_cache_dir').'/project_autoload.cache'); 19 $autoload->loadConfiguration(sfFinder::type('file')->name('autoload.yml')->in(array( 20 sfConfig::get('sf_symfony_lib_dir').'/config/config', 21 sfConfig::get('sf_config_dir'), 22 ))); 23 $autoload->register(); 23 24 25 // lime 24 26 include $configuration->getSymfonyLibDir().'/vendor/lime/lime.php'; branches/1.3/lib/task/sfBaseTask.class.php
r23063 r23205 239 239 if (!$configuration instanceof sfApplicationConfiguration) 240 240 { 241 $autoload = sfSimpleAutoload::getInstance(sfConfig::get('sf_cache_dir').'/project_autoload.cache');242 243 241 // plugins 244 242 if ($reload) … … 251 249 252 250 // project 253 $files = array(sfConfig::get('sf_symfony_lib_dir').'/config/config/autoload.yml'); 254 if (is_readable($file = sfConfig::get('sf_config_dir').'/autoload.yml')) 255 { 256 $files[] = $file; 257 } 258 259 $config = new sfAutoloadConfigHandler(); 260 foreach ($config->evaluate($files) as $class => $file) 261 { 262 $autoload->setClassPath($class, $file); 263 } 251 $autoload = sfSimpleAutoload::getInstance(sfConfig::get('sf_cache_dir').'/project_autoload.cache'); 252 $autoload->loadConfiguration(sfFinder::type('file')->name('autoload.yml')->in(array( 253 sfConfig::get('sf_symfony_lib_dir').'/config/config', 254 sfConfig::get('sf_config_dir'), 255 ))); 256 $autoload->register(); 264 257 265 258 if ($reload) … … 268 261 $autoload->reload(); 269 262 } 270 271 $autoload->register();272 263 } 273 264 }