added a way to run tests that depends on external libraries
This commit is contained in:
parent
626b88c8f1
commit
a79ad894f9
22
README
22
README
|
@ -23,6 +23,28 @@ Requirements
|
||||||
|
|
||||||
Symfony is only supported on PHP 5.3.0 and up.
|
Symfony is only supported on PHP 5.3.0 and up.
|
||||||
|
|
||||||
|
Tests
|
||||||
|
-----
|
||||||
|
|
||||||
|
To run the Symfony test suite, you need PHPUnit 3.5 or later.
|
||||||
|
|
||||||
|
If you want to run the tests that depend on external dependencies, the test
|
||||||
|
suite needs to be able to autoload them. By default, they are autoloaded from
|
||||||
|
a `vendor/` directory under the main root directory (see `autoload.php.dist`).
|
||||||
|
To put them in a different directory, create your own `autoload.php` file.
|
||||||
|
|
||||||
|
A working `vendor/` directory looks like the following:
|
||||||
|
|
||||||
|
* `doctrine/`
|
||||||
|
* `doctrine-migrations`
|
||||||
|
* `phing/`
|
||||||
|
* `propel/`
|
||||||
|
* `swiftmailer/`
|
||||||
|
* `twig/`
|
||||||
|
* `zend/`
|
||||||
|
|
||||||
|
Note that the code coverage only works if you have all dependencies installed.
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__.'/src/Symfony/Foundation/UniversalClassLoader.php';
|
||||||
|
|
||||||
|
use Symfony\Foundation\UniversalClassLoader;
|
||||||
|
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$loader->registerNamespaces(array(
|
||||||
|
'Doctrine\\Common' => __DIR__.'/vendor/doctrine/lib/vendor/doctrine-common/lib',
|
||||||
|
'Doctrine\\DBAL\\Migrations' => __DIR__.'/vendor/doctrine-migrations/lib',
|
||||||
|
'Doctrine\\DBAL' => __DIR__.'/vendor/doctrine/lib/vendor/doctrine-dbal/lib',
|
||||||
|
'Doctrine' => __DIR__.'/vendor/doctrine/lib',
|
||||||
|
));
|
||||||
|
$loader->registerPrefixes(array(
|
||||||
|
'Swift_' => __DIR__.'/vendor/swiftmailer/lib/classes',
|
||||||
|
'Zend_' => __DIR__.'/vendor/zend/library',
|
||||||
|
'Twig_' => __DIR__.'/vendor/twig/lib',
|
||||||
|
));
|
||||||
|
$loader->register();
|
||||||
|
|
||||||
|
// for Zend Framework & SwiftMailer
|
||||||
|
set_include_path(
|
||||||
|
__DIR__.'/vendor/zend/library'.PATH_SEPARATOR.
|
||||||
|
__DIR__.'/vendor/swiftmailer/lib'.PATH_SEPARATOR.
|
||||||
|
__DIR__.'/vendor/phing/classes'.PATH_SEPARATOR.
|
||||||
|
get_include_path()
|
||||||
|
);
|
|
@ -9,12 +9,12 @@
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
syntaxCheck="false"
|
syntaxCheck="false"
|
||||||
bootstrap="tests/Symfony/Tests/bootstrap.php"
|
bootstrap="tests/bootstrap.php"
|
||||||
>
|
>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Symfony Test Suite">
|
<testsuite name="Symfony Test Suite">
|
||||||
<directory>./tests/Symfony/</directory>
|
<directory>./tests/Symfony/</directory>
|
||||||
<directory>./src/Symfony/Framework/</directory>
|
<directory>./src/Symfony/Framework/*/Tests/</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
|
||||||
|
@ -22,13 +22,7 @@
|
||||||
<whitelist>
|
<whitelist>
|
||||||
<directory>./src/Symfony/</directory>
|
<directory>./src/Symfony/</directory>
|
||||||
<exclude>
|
<exclude>
|
||||||
<directory>./src/Symfony/Framework/DoctrineBundle</directory>
|
|
||||||
<directory>./src/Symfony/Framework/DoctrineMigrationsBundle</directory>
|
|
||||||
<directory>./src/Symfony/Framework/TwigBundle</directory>
|
|
||||||
<directory>./src/Symfony/Framework/ZendBundle</directory>
|
|
||||||
|
|
||||||
<directory>./src/Symfony/Framework/*/Resources</directory>
|
<directory>./src/Symfony/Framework/*/Resources</directory>
|
||||||
|
|
||||||
<file>./src/Symfony/Foundation/bootstrap.php</file>
|
<file>./src/Symfony/Foundation/bootstrap.php</file>
|
||||||
<file>./src/Symfony/Foundation/packager.php</file>
|
<file>./src/Symfony/Foundation/packager.php</file>
|
||||||
</exclude>
|
</exclude>
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Framework\DoctrineBundle\Tests;
|
||||||
|
|
||||||
|
class TestCase extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
if (!class_exists('Doctrine\\Common\\Version')) {
|
||||||
|
$this->markTestSkipped('Doctrine is not available.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,8 +9,8 @@
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once __DIR__.'/../../../src/Symfony/Foundation/UniversalClassLoader.php';
|
namespace Symfony\Framework\ProfilerBundle\Tests;
|
||||||
|
|
||||||
$loader = new Symfony\Foundation\UniversalClassLoader();
|
class TestCase extends \PHPUnit_Framework_TestCase
|
||||||
$loader->registerNamespace('Symfony', __DIR__.'/../../../src');
|
{
|
||||||
$loader->register();
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Framework\PropelBundle\Tests;
|
||||||
|
|
||||||
|
class TestCase extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
if (!file_exists($file = __DIR__.'/../../../../../vendor/propel/runtime/lib/Propel.php')) {
|
||||||
|
$this->markTestSkipped('Propel is not available.');
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once $file;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Framework\SwiftmailerBundle\Tests;
|
||||||
|
|
||||||
|
class TestCase extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
if (!class_exists('Swift_Mailer')) {
|
||||||
|
$this->markTestSkipped('Swiftmailer is not available.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Framework\TwigBundle\Tests;
|
||||||
|
|
||||||
|
class TestCase extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
if (!class_exists('Twig_Environment')) {
|
||||||
|
$this->markTestSkipped('Twig is not available.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Framework\WebBundle\Tests;
|
||||||
|
|
||||||
|
class TestCase extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
}
|
|
@ -9,18 +9,19 @@
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Tests\Framework\WebBundle\Util;
|
namespace Symfony\Framework\WebBundle\Tests\Util;
|
||||||
|
|
||||||
|
use Symfony\Framework\WebBundle\Tests\TestCase;
|
||||||
use Symfony\Framework\WebBundle\Util\Mustache;
|
use Symfony\Framework\WebBundle\Util\Mustache;
|
||||||
use Symfony\Framework\WebBundle\Util\Filesystem;
|
use Symfony\Framework\WebBundle\Util\Filesystem;
|
||||||
|
|
||||||
class MustacheTest extends \PHPUnit_Framework_TestCase
|
class MustacheTest extends TestCase
|
||||||
{
|
{
|
||||||
protected $dir;
|
protected $dir;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$dir = __DIR__.'/../../../../../fixtures/Symfony/Framework/WebBundle/Util';
|
$dir = __DIR__.'/fixtures/';
|
||||||
|
|
||||||
$this->dir = sys_get_temp_dir().'/mustache';
|
$this->dir = sys_get_temp_dir().'/mustache';
|
||||||
$filesystem = new Filesystem();
|
$filesystem = new Filesystem();
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Framework\ZendBundle\Tests;
|
||||||
|
|
||||||
|
class TestCase extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
if (!class_exists('Zend_Log')) {
|
||||||
|
$this->markTestSkipped('Zend Framework is not available.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once __DIR__.'/../src/Symfony/Foundation/UniversalClassLoader.php';
|
||||||
|
|
||||||
|
$loader = new Symfony\Foundation\UniversalClassLoader();
|
||||||
|
$loader->registerNamespace('Symfony', __DIR__.'/../src');
|
||||||
|
$loader->register();
|
||||||
|
|
||||||
|
if (file_exists($file = __DIR__.'/../autoload.php')) {
|
||||||
|
require_once $file;
|
||||||
|
} elseif (file_exists($file = __DIR__.'/../autoload.php.dist')) {
|
||||||
|
require_once $file;
|
||||||
|
}
|
Reference in New Issue