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; ...@@ -18,15 +18,13 @@ use Silex\Provider\FormServiceProvider;
* FormTrait test cases. * FormTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class FormTraitTest extends \PHPUnit_Framework_TestCase class FormTraitTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp() 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')) { if (!is_dir(__DIR__.'/../../../../vendor/symfony/form')) {
$this->markTestSkipped('Form dependency was not installed.'); $this->markTestSkipped('Form dependency was not installed.');
} }
......
...@@ -20,15 +20,13 @@ use Monolog\Logger; ...@@ -20,15 +20,13 @@ use Monolog\Logger;
* MonologTrait test cases. * MonologTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class MonologTraitTest extends \PHPUnit_Framework_TestCase class MonologTraitTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp() 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')) { if (!is_dir(__DIR__.'/../../../../vendor/monolog/monolog/src')) {
$this->markTestSkipped('Monolog dependency was not installed.'); $this->markTestSkipped('Monolog dependency was not installed.');
} }
......
...@@ -20,15 +20,13 @@ use Symfony\Component\HttpFoundation\Request; ...@@ -20,15 +20,13 @@ use Symfony\Component\HttpFoundation\Request;
* SecurityTrait test cases. * SecurityTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class SecurityTraitTest extends \PHPUnit_Framework_TestCase class SecurityTraitTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp() 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')) { if (!is_dir(__DIR__.'/../../../../vendor/symfony/security')) {
$this->markTestSkipped('Security dependency was not installed.'); $this->markTestSkipped('Security dependency was not installed.');
} }
......
...@@ -18,15 +18,13 @@ use Silex\Provider\SwiftmailerServiceProvider; ...@@ -18,15 +18,13 @@ use Silex\Provider\SwiftmailerServiceProvider;
* SwiftmailerTrait test cases. * SwiftmailerTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class SwiftmailerTraitTest extends \PHPUnit_Framework_TestCase class SwiftmailerTraitTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp() 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')) { if (!is_dir(__DIR__.'/../../../../vendor/swiftmailer/swiftmailer')) {
$this->markTestSkipped('Swiftmailer dependency was not installed.'); $this->markTestSkipped('Swiftmailer dependency was not installed.');
} }
......
...@@ -18,15 +18,13 @@ use Silex\Provider\TranslationServiceProvider; ...@@ -18,15 +18,13 @@ use Silex\Provider\TranslationServiceProvider;
* TranslationTrait test cases. * TranslationTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class TranslationTraitTest extends \PHPUnit_Framework_TestCase class TranslationTraitTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp() 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')) { if (!is_dir(__DIR__.'/../../../../vendor/symfony/translation')) {
$this->markTestSkipped('Translation dependency was not installed.'); $this->markTestSkipped('Translation dependency was not installed.');
} }
......
...@@ -20,15 +20,13 @@ use Symfony\Component\HttpFoundation\StreamedResponse; ...@@ -20,15 +20,13 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
* TwigTrait test cases. * TwigTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class TwigTraitTest extends \PHPUnit_Framework_TestCase class TwigTraitTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp() 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')) { if (!is_dir(__DIR__.'/../../../../vendor/twig/twig')) {
$this->markTestSkipped('Twig dependency was not installed.'); $this->markTestSkipped('Twig dependency was not installed.');
} }
......
...@@ -18,16 +18,11 @@ use Silex\Provider\UrlGeneratorServiceProvider; ...@@ -18,16 +18,11 @@ use Silex\Provider\UrlGeneratorServiceProvider;
* UrlGeneratorTrait test cases. * UrlGeneratorTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class UrlGeneratorTraitTest extends \PHPUnit_Framework_TestCase 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() public function testUrl()
{ {
$app = $this->createApplication(); $app = $this->createApplication();
......
...@@ -38,6 +38,10 @@ class DoctrineServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -38,6 +38,10 @@ class DoctrineServiceProviderTest extends \PHPUnit_Framework_TestCase
public function testSingleConnection() public function testSingleConnection()
{ {
if (!in_array('sqlite', \PDO::getAvailableDrivers())) {
$this->markTestSkipped('pdo_sqlite is not available');
}
$app = new Application(); $app = new Application();
$app->register(new DoctrineServiceProvider(), array( $app->register(new DoctrineServiceProvider(), array(
'db.options' => array('driver' => 'pdo_sqlite', 'memory' => true), 'db.options' => array('driver' => 'pdo_sqlite', 'memory' => true),
...@@ -55,6 +59,10 @@ class DoctrineServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -55,6 +59,10 @@ class DoctrineServiceProviderTest extends \PHPUnit_Framework_TestCase
public function testMultipleConnections() public function testMultipleConnections()
{ {
if (!in_array('sqlite', \PDO::getAvailableDrivers())) {
$this->markTestSkipped('pdo_sqlite is not available');
}
$app = new Application(); $app = new Application();
$app->register(new DoctrineServiceProvider(), array( $app->register(new DoctrineServiceProvider(), array(
'dbs.options' => array( 'dbs.options' => array(
......
...@@ -19,15 +19,13 @@ use Symfony\Component\HttpFoundation\Request; ...@@ -19,15 +19,13 @@ use Symfony\Component\HttpFoundation\Request;
* SecurityTrait test cases. * SecurityTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class SecurityTraitTest extends \PHPUnit_Framework_TestCase class SecurityTraitTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp() 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')) { if (!is_dir(__DIR__.'/../../../../vendor/symfony/security')) {
$this->markTestSkipped('Security dependency was not installed.'); $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