diff --git a/.travis.yml b/.travis.yml index 8cae141562..0a430d1fc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,4 @@ php: - 5.3 - 5.4 -before_script: php vendors.php +before_script: wget http://getcomposer.org/composer.phar && php composer.phar --install-suggests install diff --git a/autoload.php.dist b/autoload.php.dist deleted file mode 100644 index 493a00bea2..0000000000 --- a/autoload.php.dist +++ /dev/null @@ -1,40 +0,0 @@ -addPrefixes(array( - 'Symfony\\Tests\\' => __DIR__.'/tests', - 'Symfony\\' => __DIR__.'/src', - 'Doctrine\\Common\\DataFixtures\\' => __DIR__.'/vendor/doctrine-fixtures/lib', - 'Doctrine\\Common\\' => __DIR__.'/vendor/doctrine-common/lib', - 'Doctrine\\DBAL\\' => __DIR__.'/vendor/doctrine-dbal/lib', - 'Doctrine\\ORM\\' => __DIR__.'/vendor/doctrine/lib', - 'Monolog\\' => __DIR__.'/vendor/monolog/src', - 'Twig_' => __DIR__.'/vendor/twig/lib', -)); -if (!function_exists('intl_get_error_code')) { - require_once __DIR__.'/src/Symfony/Component/Locale/Resources/stubs/functions.php'; - - $loader->addPrefix('', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs'); -} -if (!interface_exists('SessionHandlerInterface', false)) { - $loader->addPrefix('SessionHandlerInterface', __DIR__.'/src/Symfony/Component/HttpFoundation/Resources/stubs'); -} -$loader->register(); - -if (is_file(__DIR__.'/vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php')) { - AnnotationRegistry::registerLoader(array($loader, 'loadClass')); -} - -if (is_file(__DIR__.'/vendor/swiftmailer/lib/classes/Swift.php')) { - require_once __DIR__.'/vendor/swiftmailer/lib/classes/Swift.php'; - Swift::registerAutoload(__DIR__.'/vendor/swiftmailer/lib/swift_init.php'); -} - -if (is_file($file = __DIR__.'/vendor/propel/runtime/lib/Propel.php')) { - require_once $file; -} diff --git a/composer.autoload.php.dist b/composer.autoload.php.dist new file mode 100644 index 0000000000..27b06d20cc --- /dev/null +++ b/composer.autoload.php.dist @@ -0,0 +1,27 @@ +add('Symfony\\Tests', __DIR__.'/tests'); + +use Doctrine\Common\Annotations\AnnotationRegistry; + +if (!function_exists('intl_get_error_code')) { + require_once __DIR__.'/src/Symfony/Component/Locale/Resources/stubs/functions.php'; + + $loader->add('IntlDateFormatter', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs'); + $loader->add('Collator', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs'); + $loader->add('Locale', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs'); + $loader->add('NumberFormatter', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs'); +} + +AnnotationRegistry::registerLoader(array($loader, 'loadClass')); +AnnotationRegistry::registerFile(__DIR__.'/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'); + +if (is_file(__DIR__.'/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php')) { + require_once __DIR__.'/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php'; + Swift::registerAutoload(__DIR__.'/vendor/swiftmailer/swiftmailer/lib/swift_init.php'); +} + +if (is_file($file = __DIR__.'/vendor/propel/propel/runtime/lib/Propel.php')) { + require_once $file; +} diff --git a/composer.json b/composer.json index 1f22a35020..ec6dbfb30a 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,10 @@ "symfony/yaml": "self.version" }, "suggest": { - "doctrine/data-fixtures": "1.0.*" + "doctrine/dbal": "2.2.*", + "doctrine/orm": "2.2.*", + "doctrine/data-fixtures": "1.0.*", + "propel/propel1": "dev-master" }, "autoload": { "psr-0": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5ace6ac11a..84ebc9d4ea 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,7 +9,7 @@ processIsolation="false" stopOnFailure="false" syntaxCheck="false" - bootstrap="autoload.php.dist" + bootstrap="composer.autoload.php.dist" > diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php index 655c9c74e9..91ffd16966 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php @@ -22,6 +22,14 @@ while ($dir !== $lastDir) { break; } + if ( + file_exists($dir.'/vendor/.composer/autoload.php') + && file_exists($dir.'/composer.autoload.php.dist') + ) { + require_once $dir.'/composer.autoload.php.dist'; + break; + } + if (file_exists($dir.'/autoload.php.dist')) { require_once $dir.'/autoload.php.dist'; break; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php index dbe618feac..b88f8cea8e 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php @@ -22,6 +22,14 @@ while ($dir !== $lastDir) { break; } + if ( + file_exists($dir.'/vendor/.composer/autoload.php') + && file_exists($dir.'/composer.autoload.php.dist') + ) { + require_once $dir.'/composer.autoload.php.dist'; + break; + } + if (is_file($dir.'/autoload.php.dist')) { require_once $dir.'/autoload.php.dist'; break; diff --git a/vendors.php b/vendors.php deleted file mode 100755 index 2b3abaa1f0..0000000000 --- a/vendors.php +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env php - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* - -CAUTION: This file installs the dependencies needed to run the Symfony2 test suite. -If you want to create a new project, download the Symfony Standard Edition instead: - -http://symfony.com/download - -*/ - -set_time_limit(0); - -if (!is_dir($vendorDir = dirname(__FILE__).'/vendor')) { - mkdir($vendorDir, 0777, true); -} - -// optional transport change -$transport = false; -if (isset($argv[1]) && in_array($argv[1], array('--transport=http', '--transport=https', '--transport=git'))) { - $transport = preg_replace('/^--transport=(.*)$/', '$1', $argv[1]); -} - -$deps = array( - array('doctrine', 'http://github.com/doctrine/doctrine2.git', 'origin/master'), - array('doctrine-dbal', 'http://github.com/doctrine/dbal.git', 'origin/master'), - array('doctrine-fixtures', 'https://github.com/doctrine/data-fixtures.git', 'origin/master'), - array('doctrine-common', 'http://github.com/doctrine/common.git', 'origin/master'), - array('twig', 'http://github.com/fabpot/Twig.git', 'origin/master'), - array('propel', 'http://github.com/propelorm/Propel.git', 'origin/master'), - array('monolog', 'https://github.com/Seldaek/monolog.git', 'origin/master'), -); - -foreach ($deps as $dep) { - list($name, $url, $rev) = $dep; - - if ($transport) { - $url = preg_replace('/^(http:|https:|git:)(.*)/', $transport . ':$2', $url); - } - - $installDir = $vendorDir.'/'.$name; - $install = false; - if (!is_dir($installDir)) { - $install = true; - echo "> Installing $name\n"; - - system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir))); - } - - if (!$install) { - echo "> Updating $name\n"; - } - - system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev))); -}