Added scripts to run phpunit tests

This commit is contained in:
Francis Besset 2011-07-14 17:41:28 +02:00
parent ab1d720e13
commit 7ddf05cec1
5 changed files with 93 additions and 1 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
phpunit.xml
vendor

View File

@ -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;

25
Tests/bootstrap.php Normal file
View File

@ -0,0 +1,25 @@
<?php
require_once $_SERVER['SYMFONY'].'/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->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;
}
});

24
phpunit.xml.dist Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="Tests/bootstrap.php"
>
<php>
<server name="SYMFONY" value="./vendor/symfony/src" />
<server name="ZEND" value="./vendor/zend/library" />
</php>
<testsuites>
<testsuite name="SoapBundle Test Suite">
<directory>./Tests</directory>
</testsuite>
</testsuites>
</phpunit>

41
vendors.php Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env php
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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)));
}