Commit 3563829a authored by Fabien Potencier's avatar Fabien Potencier

merged branch vicb/test2 (PR #624)

This PR was merged into the master branch.

Commits
-------

8e11cfa5 [Tests] Make use of the @requires annotation for PHP version
1e0dd622 Fix Doctrine tests

Discussion
----------

[Test] Improvements

see https://github.com/fabpot/Silex/pull/620
parents e69e9f00 8e11cfa5
......@@ -18,15 +18,13 @@ use Silex\Provider\FormServiceProvider;
* FormTrait test cases.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/
class FormTraitTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
if (version_compare(phpversion(), '5.4.0', '<')) {
$this->markTestSkipped('PHP 5.4 is required for this test');
}
if (!is_dir(__DIR__.'/../../../../vendor/symfony/form')) {
$this->markTestSkipped('Form dependency was not installed.');
}
......
......@@ -20,15 +20,13 @@ use Monolog\Logger;
* MonologTrait test cases.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/
class MonologTraitTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
if (version_compare(phpversion(), '5.4.0', '<')) {
$this->markTestSkipped('PHP 5.4 is required for this test');
}
if (!is_dir(__DIR__.'/../../../../vendor/monolog/monolog/src')) {
$this->markTestSkipped('Monolog dependency was not installed.');
}
......
......@@ -20,15 +20,13 @@ use Symfony\Component\HttpFoundation\Request;
* SecurityTrait test cases.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/
class SecurityTraitTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
if (version_compare(phpversion(), '5.4.0', '<')) {
$this->markTestSkipped('PHP 5.4 is required for this test');
}
if (!is_dir(__DIR__.'/../../../../vendor/symfony/security')) {
$this->markTestSkipped('Security dependency was not installed.');
}
......
......@@ -18,15 +18,13 @@ use Silex\Provider\SwiftmailerServiceProvider;
* SwiftmailerTrait test cases.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/
class SwiftmailerTraitTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
if (version_compare(phpversion(), '5.4.0', '<')) {
$this->markTestSkipped('PHP 5.4 is required for this test');
}
if (!is_dir(__DIR__.'/../../../../vendor/swiftmailer/swiftmailer')) {
$this->markTestSkipped('Swiftmailer dependency was not installed.');
}
......
......@@ -18,15 +18,13 @@ use Silex\Provider\TranslationServiceProvider;
* TranslationTrait test cases.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/
class TranslationTraitTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
if (version_compare(phpversion(), '5.4.0', '<')) {
$this->markTestSkipped('PHP 5.4 is required for this test');
}
if (!is_dir(__DIR__.'/../../../../vendor/symfony/translation')) {
$this->markTestSkipped('Translation dependency was not installed.');
}
......
......@@ -20,15 +20,13 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
* TwigTrait test cases.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/
class TwigTraitTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
if (version_compare(phpversion(), '5.4.0', '<')) {
$this->markTestSkipped('PHP 5.4 is required for this test');
}
if (!is_dir(__DIR__.'/../../../../vendor/twig/twig')) {
$this->markTestSkipped('Twig dependency was not installed.');
}
......
......@@ -18,16 +18,11 @@ use Silex\Provider\UrlGeneratorServiceProvider;
* UrlGeneratorTrait test cases.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/
class UrlGeneratorTraitTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
if (version_compare(phpversion(), '5.4.0', '<')) {
$this->markTestSkipped('PHP 5.4 is required for this test');
}
}
public function testUrl()
{
$app = $this->createApplication();
......
......@@ -38,6 +38,10 @@ class DoctrineServiceProviderTest extends \PHPUnit_Framework_TestCase
public function testSingleConnection()
{
if (!in_array('sqlite', \PDO::getAvailableDrivers())) {
$this->markTestSkipped('pdo_sqlite is not available');
}
$app = new Application();
$app->register(new DoctrineServiceProvider(), array(
'db.options' => array('driver' => 'pdo_sqlite', 'memory' => true),
......@@ -55,6 +59,10 @@ class DoctrineServiceProviderTest extends \PHPUnit_Framework_TestCase
public function testMultipleConnections()
{
if (!in_array('sqlite', \PDO::getAvailableDrivers())) {
$this->markTestSkipped('pdo_sqlite is not available');
}
$app = new Application();
$app->register(new DoctrineServiceProvider(), array(
'dbs.options' => array(
......
......@@ -19,15 +19,13 @@ use Symfony\Component\HttpFoundation\Request;
* SecurityTrait test cases.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/
class SecurityTraitTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
if (version_compare(phpversion(), '5.4.0', '<')) {
$this->markTestSkipped('PHP 5.4 is required for this test');
}
if (!is_dir(__DIR__.'/../../../../vendor/symfony/security')) {
$this->markTestSkipped('Security dependency was not installed.');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment