From 7ddf05cec1614662ac4eb3ca0b90ef4c319fe4a5 Mon Sep 17 00:00:00 2001 From: Francis Besset Date: Thu, 14 Jul 2011 17:41:28 +0200 Subject: [PATCH] Added scripts to run phpunit tests --- .gitignore | 2 ++ Tests/{ => Soap}/SoapRequestTest.php | 2 +- Tests/bootstrap.php | 25 +++++++++++++++++ phpunit.xml.dist | 24 ++++++++++++++++ vendors.php | 41 ++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 .gitignore rename Tests/{ => Soap}/SoapRequestTest.php (97%) create mode 100644 Tests/bootstrap.php create mode 100644 phpunit.xml.dist create mode 100755 vendors.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09fafaa --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +phpunit.xml +vendor diff --git a/Tests/SoapRequestTest.php b/Tests/Soap/SoapRequestTest.php similarity index 97% rename from Tests/SoapRequestTest.php rename to Tests/Soap/SoapRequestTest.php index 8256815..1185ee6 100644 --- a/Tests/SoapRequestTest.php +++ b/Tests/Soap/SoapRequestTest.php @@ -8,7 +8,7 @@ * with this source code in the file LICENSE. */ -namespace Bundle\WebServiceBundle\Tests; +namespace Bundle\WebServiceBundle\Tests\Soap; use Bundle\WebServiceBundle\Soap\SoapRequest; diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php new file mode 100644 index 0000000..798095e --- /dev/null +++ b/Tests/bootstrap.php @@ -0,0 +1,25 @@ +registerNamespace('Symfony', $_SERVER['SYMFONY']); +$loader->registerNamespace('Zend', $_SERVER['ZEND']); +$loader->register(); + +spl_autoload_register(function($class) { + //if (0 === strpos($class, 'BeSimple\\SoapBundle\\')) { + if (0 === strpos($class, 'Bundle\\WebServiceBundle\\')) { + $path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 2)).'.php'; + + if (file_exists($path)) { + require_once $path; + + return true; + } + + return false; + } +}); \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..4024132 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,24 @@ + + + + + + + + + + + ./Tests + + + \ No newline at end of file diff --git a/vendors.php b/vendors.php new file mode 100755 index 0000000..47b53e5 --- /dev/null +++ b/vendors.php @@ -0,0 +1,41 @@ +#!/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 I18nRoutingBundle test suite. + +https://github.com/BeSimple/I18nRoutingBundle + +*/ + +if (!is_dir($vendorDir = dirname(__FILE__).'/vendor')) { + mkdir($vendorDir, 0777, true); +} + +$deps = array( + array('symfony', 'http://github.com/symfony/symfony.git', 'origin/HEAD'), + array('zend', 'http://github.com/zendframework/zf2.git', 'origin/HEAD'), +); + +foreach ($deps as $dep) { + list($name, $url, $rev) = $dep; + + echo "> Installing/Updating $name\n"; + + $installDir = $vendorDir.'/'.$name; + if (!is_dir($installDir)) { + system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir))); + } + + system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev))); +}