From 1f35b6b55bc0155f86cea138879fe70e3cffd8cf Mon Sep 17 00:00:00 2001 From: William DURAND Date: Fri, 20 Apr 2012 13:22:24 +0200 Subject: [PATCH] Switched to composer to run the test suite --- .gitignore | 10 +++---- .travis.yml | 4 ++- .../PropelGeneratorAwareCommandTest.php | 2 +- Tests/TestCase.php | 12 ++++---- Tests/autoload.php.dist | 29 ++----------------- composer.json | 6 ++++ vendor/install_vendors.php | 27 ----------------- 7 files changed, 22 insertions(+), 68 deletions(-) delete mode 100755 vendor/install_vendors.php diff --git a/.gitignore b/.gitignore index 55d45be..c52f460 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ -/Model/*/map -/Model/*/om -vendor/phing/ -vendor/propel/ -vendor/symfony/ -vendor/Sensio/ +Model/*/map +Model/*/om +vendor +composer.lock diff --git a/.travis.yml b/.travis.yml index 9b11f35..f2b6ca7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ php: env: - SYMFONY_VERSION=origin/master -before_script: php vendor/install_vendors.php +before_script: + - curl -s http://getcomposer.org/installer | php + - php composer.phar --dev install script: phpunit --coverage-text diff --git a/Tests/Command/PropelGeneratorAwareCommandTest.php b/Tests/Command/PropelGeneratorAwareCommandTest.php index 93cbc4d..8c42ebd 100644 --- a/Tests/Command/PropelGeneratorAwareCommandTest.php +++ b/Tests/Command/PropelGeneratorAwareCommandTest.php @@ -26,7 +26,7 @@ class PropelGeneratorAwareCommandTest extends TestCase parent::setUp(); $this->container = $this->getContainer(); - $this->container->setParameter('propel.path', __DIR__ . '/../../vendor/propel'); + $this->container->setParameter('propel.path', __DIR__ . '/../../vendor/propel/propel1'); } public function testGetDatabasesFromSchema() diff --git a/Tests/TestCase.php b/Tests/TestCase.php index 5c10c31..c5d0675 100644 --- a/Tests/TestCase.php +++ b/Tests/TestCase.php @@ -22,7 +22,7 @@ class TestCase extends \PHPUnit_Framework_TestCase { protected function setUp() { - if (!file_exists($file = __DIR__.'/../vendor/propel/runtime/lib/Propel.php')) { + if (!file_exists($file = __DIR__ . '/../vendor/propel/propel1/runtime/lib/Propel.php')) { $this->markTestSkipped('Propel is not available.'); } @@ -39,10 +39,10 @@ class TestCase extends \PHPUnit_Framework_TestCase protected function loadPropelQuickBuilder() { - require_once __DIR__.'/../vendor/propel/runtime/lib/Propel.php'; - require_once __DIR__.'/../vendor/propel/runtime/lib/adapter/DBAdapter.php'; - require_once __DIR__.'/../vendor/propel/runtime/lib/adapter/DBSQLite.php'; - require_once __DIR__.'/../vendor/propel/runtime/lib/connection/PropelPDO.php'; - require_once __DIR__.'/../vendor/propel/generator/lib/util/PropelQuickBuilder.php'; + require_once __DIR__ . '/../vendor/propel/propel1/runtime/lib/Propel.php'; + require_once __DIR__ . '/../vendor/propel/propel1/runtime/lib/adapter/DBAdapter.php'; + require_once __DIR__ . '/../vendor/propel/propel1/runtime/lib/adapter/DBSQLite.php'; + require_once __DIR__ . '/../vendor/propel/propel1/runtime/lib/connection/PropelPDO.php'; + require_once __DIR__ . '/../vendor/propel/propel1/generator/lib/util/PropelQuickBuilder.php'; } } diff --git a/Tests/autoload.php.dist b/Tests/autoload.php.dist index 3c31b6c..30ce93c 100644 --- a/Tests/autoload.php.dist +++ b/Tests/autoload.php.dist @@ -1,30 +1,5 @@ registerNamespaces(array( - 'Symfony' => array($vendorDir.'/symfony/src'), - 'Sensio\\Bundle\\FrameworkExtraBundle' => array($vendorDir), -)); -$loader->registerPrefixes(array( - 'Twig_' => $vendorDir.'/symfony/vendor/twig/lib', -)); -$loader->register(); - -set_include_path(get_include_path() . PATH_SEPARATOR . $vendorDir.'/phing/classes'); - -spl_autoload_register(function($class) { - if (0 === strpos($class, 'Propel\\PropelBundle\\')) { - $path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 2)).'.php'; - if (!stream_resolve_include_path($path)) { - return false; - } - require_once $path; - - return true; - } -}); +set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/../vendor/phing/phing/classes'); diff --git a/composer.json b/composer.json index 687e4d9..a854809 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,12 @@ "symfony/framework-bundle": "2.*", "propel/propel1": "1.6.*" }, + "require-dev": { + "symfony/symfony": "2.1.*", + "phing/phing": "2.4.*", + "sensio/framework-extra-bundle": "*", + "twig/twig": "1.7.*" + }, "autoload": { "psr-0": { "Propel\\PropelBundle": "" } }, diff --git a/vendor/install_vendors.php b/vendor/install_vendors.php deleted file mode 100755 index bdeefb8..0000000 --- a/vendor/install_vendors.php +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env php - Installing/Updating $name\n"; - - $installDir = $vendorDir.'/'.$name; - if (!is_dir($installDir)) { - system(sprintf('git clone -q %s %s', escapeshellarg($url), escapeshellarg($installDir))); - } - - system(sprintf('cd %s && git fetch -q origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev))); -} - -system(sprintf('cd %s && php vendors.php', escapeshellarg($vendorDir.'/symfony')));