diff --git a/.travis.yml b/.travis.yml index 2cdc5cf..429b6d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,14 +2,15 @@ language: php php: - 5.3 -# - 5.4 env: - SYMFONY_VERSION=v2.0.7 # - SYMFONY_VERSION=origin/2.0 # - SYMFONY_VERSION=origin/master -before_script: php Tests/vendor/vendors.php +before_script: + - wget -nc http://getcomposer.org/composer.phar + - php composer.phar update script: phpunit diff --git a/Tests/autoload.php.dist b/Tests/autoload.php.dist deleted file mode 100644 index c6d4f13..0000000 --- a/Tests/autoload.php.dist +++ /dev/null @@ -1,63 +0,0 @@ -registerNamespace('Symfony', array($_SERVER['SYMFONY_SRC'], $_SERVER['SYMFONY_BUNDLE'])); -$loader->registerNamespace('Rebolon', $_SERVER['SYMFONY_BUNDLE']); -$loader->registerNamespace('Monolog', $_SERVER['SYMFONY_VENDORS'] . '/monolog/src'); // only to be compatible with the config.yml loaded by config_dev and then config_test -/* * / -$loader->registerNamespace('Sensio', $_SERVER['SYMFONY_BUNDLE']); // only to be compatible with the config.yml loaded by config_dev and then config_test -$loader->registerNamespace('JMS', $_SERVER['SYMFONY_BUNDLE']); // only to be compatible with the config.yml loaded by config_dev and then config_test -$loader->registerNamespace('Highlight', $_SERVER['SYMFONY_BUNDLE']); // only to be compatible with the config.yml loaded by config_dev and then config_test -/* * / -$loader->register(); -*/ - -echo "> Initialize autoload\n"; - -// try to reuse lib defined in a current symfony2 project -$autoload = __DIR__ . '/../../../../../app/bootstrap.php.cache'; -$autoload = null; -if (is_file($autoload)) { - include $autoload; -} else { - $vendorDir = __DIR__ . '/vendor'; - if (!is_file($vendorDir . '/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php')) { - echo "Run Tests/vendor/vendors.php before phpunit\n"; - exit; - } - require_once $vendorDir . '/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; - - $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); - $loader->registerNamespaces(array( - 'Symfony' => array($vendorDir . '/symfony/src'), - // will fail on travis because my gitHub username was rebolon instead of - // Rebolon => so path for include class will be rebolon/PagerBundle/* - // instead of Rebolon/PagerBundle/* which will always fail on linux - 'Rebolon' => array($vendorDir . '/../../../..'), - )); - - $loader->registerPrefixes(array( - 'Twig_' => $vendorDir . '/twig/lib', - )); - $loader->register(); - - // because of github username (rebolon with lower r) i have to register a - // specific autoload for the current bundle - spl_autoload_register(function($class) { - if (0 === strpos($class, 'Rebolon\\PagerBundle\\')) { - $path = __DIR__ . '/../' . implode('/', array_slice(explode('\\', $class), 2)) . '.php'; - - if (!stream_resolve_include_path($path)) { - return false; - } - require_once $path; - return true; - } - }); -} \ No newline at end of file diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php index 4f8b81a..7d7167e 100644 --- a/Tests/bootstrap.php +++ b/Tests/bootstrap.php @@ -1,13 +1,17 @@ register(); -if (file_exists($file = __DIR__.'/autoload.php')) { - require_once $file; -} elseif (file_exists($file = __DIR__.'/autoload.php.dist')) { - require_once $file; -} +// @todo : resolve this autoload requirements whereas it should not be !!! +spl_autoload_register(function($class) { + if (0 === strpos($class, 'Rebolon\\PagerBundle\\')) { + $path = __DIR__ . '/../' . implode('/', array_slice(explode('\\', $class), 2)) . '.php'; + + if (!stream_resolve_include_path($path)) { + return false; + } + require_once $path; + return true; + } +}); diff --git a/Tests/vendor/vendors.php b/Tests/vendor/vendors.php deleted file mode 100644 index be49968..0000000 --- a/Tests/vendor/vendors.php +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env php - Installing/Updating $name\n"; - - $installDir = $vendorDir.'/'.$name; - if (!is_dir($installDir)) { - system(sprintf('git clone --quiet %s %s', escapeshellarg($url), escapeshellarg($installDir))); - } - - system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev))); -} - diff --git a/composer.json b/composer.json index cb73361..0488691 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "require": { "symfony/framework-bundle": "2.*", - "twig/twig": "1.*", + "twig/twig": "1.*" }, "autoload": { "psr-0": { "Rebolon\\PagerBundle": "" } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3d08ad5..fbe6591 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,7 +11,7 @@ ./Tests - ./Tests/vendor + ./vendor ./Tests/cache ./Tests/logs ./Tests/Units @@ -22,6 +22,7 @@ ./ + ./vendor ./Tests