From b8af36f411f0f6840879e19371aae756d41e7b32 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Sat, 12 Nov 2011 01:00:44 +0100 Subject: [PATCH] travis-ci --- .gitignore | 3 +++ .travis.yml | 4 ++++ Tests/autoload.php.dist | 24 ++++++++++++++++++++++++ Tests/bootstrap.php | 27 ++++----------------------- phpunit.xml.dist | 6 ------ vendor/vendors.php | 28 ++++++++++++++++++++++++++++ 6 files changed, 63 insertions(+), 29 deletions(-) create mode 100644 .travis.yml create mode 100644 Tests/autoload.php.dist create mode 100644 vendor/vendors.php diff --git a/.gitignore b/.gitignore index 319b3826f..50027b592 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ /phpunit.xml + +vendor/imagine +vendor/symfony \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..462f0e0d6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: php +php: 5.3.8 +before_script: php vendor/vendors.php +script: phpunit --colors -c phpunit.xml.dist diff --git a/Tests/autoload.php.dist b/Tests/autoload.php.dist new file mode 100644 index 000000000..5e4cecae5 --- /dev/null +++ b/Tests/autoload.php.dist @@ -0,0 +1,24 @@ +registerNamespaces(array( + 'Symfony' => array($vendorDir.'/symfony/src'), + 'Imagine' => array($vendorDir.'/imagine/lib'), +)); +$loader->register(); + +spl_autoload_register(function($class) { + if (0 === strpos($class, 'Liip\\ImagineBundle\\')) { + $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/bootstrap.php b/Tests/bootstrap.php index 56c074c0e..510c33ae8 100644 --- a/Tests/bootstrap.php +++ b/Tests/bootstrap.php @@ -1,26 +1,7 @@ registerNamespace('Symfony', SYMFONY_SRC_DIR); -$loader->registerNamespace('Imagine', IMAGINE_SRC_DIR); -$loader->register(); diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c22edde42..6e1577609 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -27,10 +27,4 @@ - - - - - - diff --git a/vendor/vendors.php b/vendor/vendors.php new file mode 100644 index 000000000..b3a0a1189 --- /dev/null +++ b/vendor/vendors.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php + Installing/Updating $name\n"; + + $installDir = $vendorDir.'/'.$name; + if (!is_dir($installDir)) { + system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir))); + } + + if ($rev) { + system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev))); + } +}