diff options
author | Remi Collet <fedora@famillecollet.com> | 2015-06-30 07:10:10 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2015-06-30 07:10:10 +0200 |
commit | 896cf5ccd79fd1c4e6e3fc82c3b2fb2975116945 (patch) | |
tree | 704ded659d789ca7d8b8bc915898e8d9d5e09b1f /Autoload.php.in | |
parent | 2270dcf9ae3646692514f168b9d4f469af11d5f6 (diff) |
php-phpunit-PHPUnit: autoloader
Diffstat (limited to 'Autoload.php.in')
-rw-r--r-- | Autoload.php.in | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/Autoload.php.in b/Autoload.php.in index 09be638..141aa8c 100644 --- a/Autoload.php.in +++ b/Autoload.php.in @@ -1,5 +1,5 @@ <?php -/* Inspipred from Autoload from version 3.7 */ +/* Autoloader for phpunit/phpunit and its dependencies */ /* Required */ require_once 'File/Iterator/Autoload.php'; @@ -18,15 +18,18 @@ require_once 'Doctrine/Instantiator/autoload.php'; require_once 'Prophecy/autoload.php'; $vendorDir = '/usr/share/php'; -if (!(isset($sfuloader) && $sfuloader instanceof Symfony\Component\ClassLoader\UniversalClassLoader)) { - require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; - $sfuloader = new Symfony\Component\ClassLoader\UniversalClassLoader(); - $sfuloader->register(); +// Use Symfony autoloader +if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { + if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { + require_once $vendorDir . '/Symfony/Component/ClassLoader/ClassLoader.php'; + } + + $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); + $fedoraClassLoader->register(); } -$sfuloader->registerNamespaces(array( - 'Symfony\\Component\\Yaml' => $vendorDir, - 'Symfony\\Component\\ClassLoader' => $vendorDir, -)); + +/* for symfony/yaml */ +$fedoraClassLoader->addPrefix('Symfony\\Component\\', $vendorDir); spl_autoload_register( function ($class) |