Skip to content
This repository
Browse code

Switched the testsuite to composer

  • Loading branch information...
commit 724511a46a0b8978986ff2b2bfa8712fba3f5bbb 1 parent 7d2f0a1
Christophe Coevoet stof authored
8 .gitignore
... ... @@ -1,6 +1,4 @@
1 1 /phpunit.xml
2   -/tests/autoload.php
3   -/vendor/twig
4   -/vendor/pimple
5   -/vendor/Symfony
6   -/vendor/Silex
  2 +/vendor/
  3 +/composer.lock
  4 +/composer.phar
6 .travis.yml
... ... @@ -1,5 +1,9 @@
1 1 language: php
  2 +
2 3 php:
3 4 - 5.3
4 5 - 5.4
5   -before_script: php vendor/vendors.php
  6 +
  7 +before_script:
  8 + - wget -nc http://getcomposer.org/composer.phar
  9 + - php composer.phar install --dev
25 tests/autoload.php.dist
... ... @@ -1,25 +0,0 @@
1   -<?php
2   -
3   -$twig = __DIR__.'/../vendor/twig/lib/Twig/Autoloader.php';
4   -if (file_exists($twig)) {
5   - require_once $twig;
6   - Twig_Autoloader::register();
7   -}
8   -
9   -$pimple = __DIR__.'/../vendor/pimple/lib/Pimple.php';
10   -if (file_exists($pimple)) {
11   - require_once $pimple;
12   -}
13   -
14   -spl_autoload_register(function($class) {
15   - $namespaces = array('Knp\Menu\Tests' => __DIR__, 'Knp\Menu' => __DIR__.'/../src', 'Symfony' => __DIR__.'/../vendor/', 'Silex' => __DIR__.'/../vendor/Silex/src');
16   - $class = ltrim($class, '\\');
17   - foreach ($namespaces as $namespace => $dir) {
18   - if (0 === strpos($class, $namespace)) {
19   - $file = $dir.'/'.str_replace('\\', '/', $class).'.php';
20   - if (file_exists($file)) {
21   - require $file;
22   - }
23   - }
24   - }
25   -});
15 tests/bootstrap.php
... ... @@ -1,7 +1,14 @@
1 1 <?php
2 2
3   -if (file_exists($file = __DIR__.'/autoload.php')) {
4   - require_once $file;
5   -} elseif (file_exists($file = __DIR__.'/autoload.php.dist')) {
6   - require_once $file;
  3 +function includeIfExists($file) {
  4 + if (file_exists($file)) {
  5 + return include $file;
  6 + }
7 7 }
  8 +
  9 +if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  10 + die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
  11 + 'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
  12 + 'php composer.phar install'.PHP_EOL);
  13 +}
  14 +$loader->add('Knp\Menu\Tests\\', __DIR__);
38 vendor/vendors.php
... ... @@ -1,38 +0,0 @@
1   -#!/usr/bin/env php
2   -<?php
3   -
4   -/*
5   - * This file is part of the FOSUserBundle package.
6   - *
7   - * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
8   - *
9   - * For the full copyright and license information, please view the LICENSE
10   - * file that was distributed with this source code.
11   - */
12   -
13   -set_time_limit(0);
14   -
15   -$vendorDir = __DIR__;
16   -$deps = array(
17   - array('Symfony/Component/Routing', 'git://github.com/symfony/Routing.git', 'origin/master'),
18   - array('Symfony/Component/HttpFoundation', 'git://github.com/symfony/HttpFoundation.git', 'origin/master'),
19   - array('Symfony/Component/HttpKernel', 'git://github.com/symfony/HttpKernel.git', 'origin/master'),
20   - array('Symfony/Component/EventDispatcher', 'git://github.com/symfony/EventDispatcher.git', 'origin/master'),
21   - array('Symfony/Component/ClassLoader', 'git://github.com/symfony/ClassLoader.git', 'origin/master'),
22   - array('twig', 'git://github.com/fabpot/Twig.git', 'origin/master'),
23   - array('Silex', 'git://github.com/fabpot/Silex.git', 'origin/master'),
24   - array('pimple', 'git://github.com/fabpot/Pimple.git', 'origin/master'),
25   -);
26   -
27   -foreach ($deps as $dep) {
28   - list($name, $url, $rev) = $dep;
29   -
30   - echo "> Installing/Updating $name\n";
31   -
32   - $installDir = $vendorDir.'/'.$name;
33   - if (!is_dir($installDir)) {
34   - system(sprintf('git clone -q %s %s', escapeshellarg($url), escapeshellarg($installDir)));
35   - }
36   -
37   - system(sprintf('cd %s && git fetch -q origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
38   -}

0 comments on commit 724511a

Please sign in to comment.
Something went wrong with that request. Please try again.