minor #16207 [ci] Fix tests requirements (nicolas-grekas)

This PR was merged into the 2.3 branch.

Discussion
----------

[ci] Fix tests requirements

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

3c0b441 [ci] Fix tests requirements
This commit is contained in:
Nicolas Grekas 2015-10-12 11:18:33 +02:00
commit f14aa486d9
11 changed files with 38 additions and 46 deletions

View File

@ -32,7 +32,7 @@ before_install:
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then phpenv config-rm xdebug.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" =~ 5.[34] ]]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" =~ 5.[34] ]]; then echo -e "extension = apc.so\napc.enable_cli = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (pecl install -f memcached-2.1.0 && echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without memcache extension"; fi;
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi;
- if [ "$deps" != "skip" ]; then ./phpunit install; fi;

View File

@ -26,8 +26,8 @@ install:
- IF %PHP%==1 cd ext
- IF %PHP%==1 appveyor DownloadFile http://nebm.ist.utl.pt/~glopes/misc/intl_win/php_intl-3.0.0-5.3-nts-vc9-x86.zip
- IF %PHP%==1 7z x php_intl-3.0.0-5.3-nts-vc9-x86.zip -y > 7z.log
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apc/3.1.13/php_apc-3.1.13-5.3-nts-vc9-x86.zip
- IF %PHP%==1 7z x php_apc-3.1.13-5.3-nts-vc9-x86.zip -y > 7z.log
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apcu/4.0.7/php_apcu-4.0.7-5.3-nts-vc9-x86.zip
- IF %PHP%==1 7z x php_apcu-4.0.7-5.3-nts-vc9-x86.zip -y > 7z.log
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/memcache/3.0.8/php_memcache-3.0.8-5.3-nts-vc9-x86.zip
- IF %PHP%==1 7z x php_memcache-3.0.8-5.3-nts-vc9-x86.zip -y > 7z.log
- IF %PHP%==1 cd ..
@ -38,7 +38,8 @@ install:
- IF %PHP%==1 echo extension_dir=ext >> php.ini-min
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini-min
- IF %PHP%==1 copy /Y php.ini-min php.ini-max
- IF %PHP%==1 echo extension=php_apc.dll >> php.ini-max
- IF %PHP%==1 echo extension=php_apcu.dll >> php.ini-max
- IF %PHP%==1 echo apc.enable_cli=1 >> php.ini-max
- IF %PHP%==1 echo extension=php_intl.dll >> php.ini-max
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini-max
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini-max

View File

@ -20,10 +20,10 @@ class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli'))) {
$this->markTestSkipped('The apc extension is available, but not enabled.');
} else {
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
apc_clear_cache('user');
} else {
$this->markTestSkipped('APC is not enabled.');
}
}

View File

@ -122,13 +122,10 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
/**
* @dataProvider dataProvider
* @requires PHP 5.3.7
*/
public function testReverseTransformUsingPipe($format, $input, $output)
{
if (PHP_VERSION_ID < 50307) {
$this->markTestSkipped('Pipe usage requires PHP 5.3.7 or newer.');
}
$reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, true);
$output = new \DateTime($output);

View File

@ -42,13 +42,10 @@ class TrimListenerTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider spaceProvider
* @requires extension mbstring
*/
public function testTrimUtf8Separators($hex)
{
if (!function_exists('mb_convert_encoding')) {
$this->markTestSkipped('The "mb_convert_encoding" function is not available');
}
// Convert hexadecimal representation into binary
// H: hex string, high nibble first (UCS-2BE)
// *: repeat until end of string

View File

@ -47,19 +47,20 @@ class MongoDbProfilerStorageTestDataCollector extends DataCollector
}
}
/**
* @requires extension mongo
*/
class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
{
protected static $storage;
public static function setUpBeforeClass()
{
if (extension_loaded('mongo')) {
self::$storage = new DummyMongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400);
try {
self::$storage->getMongo();
} catch (\MongoConnectionException $e) {
self::$storage = null;
}
self::$storage = new DummyMongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400);
try {
self::$storage->getMongo();
} catch (\MongoConnectionException $e) {
self::$storage = null;
}
}
@ -159,7 +160,7 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
if (self::$storage) {
self::$storage->purge();
} else {
$this->markTestSkipped('MongoDbProfilerStorageTest requires the mongo PHP extension and a MongoDB server on localhost');
$this->markTestSkipped('A MongoDB server on localhost is required.');
}
}
}

View File

@ -13,6 +13,9 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler;
use Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage;
/**
* @requires extension pdo_sqlite
*/
class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
{
protected static $dbFile;
@ -34,9 +37,6 @@ class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
protected function setUp()
{
if (!class_exists('SQLite3') && (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers()))) {
$this->markTestSkipped('This test requires SQLite support in your environment');
}
self::$storage->purge();
}

View File

@ -17,6 +17,9 @@ use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use Symfony\Component\Security\Acl\Dbal\Schema;
use Doctrine\DBAL\DriverManager;
/**
* @requires extension pdo_sqlite
*/
class AclProviderTest extends \PHPUnit_Framework_TestCase
{
protected $con;
@ -141,10 +144,6 @@ class AclProviderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) {
self::markTestSkipped('This test requires SQLite support in your environment');
}
$this->con = DriverManager::getConnection(array(
'driver' => 'pdo_sqlite',
'memory' => true,

View File

@ -27,6 +27,9 @@ use Symfony\Component\Security\Acl\Dbal\Schema;
use Doctrine\DBAL\DriverManager;
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
/**
* @requires extension pdo_sqlite
*/
class MutableAclProviderTest extends \PHPUnit_Framework_TestCase
{
protected $con;
@ -483,10 +486,6 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) {
self::markTestSkipped('This test requires SQLite support in your environment');
}
$this->con = DriverManager::getConnection(array(
'driver' => 'pdo_sqlite',
'memory' => true,

View File

@ -45,32 +45,27 @@ class BCryptPasswordEncoderTest extends \PHPUnit_Framework_TestCase
}
}
/**
* @requires PHP 5.3.7
*/
public function testResultLength()
{
$this->skipIfPhpVersionIsNotSupported();
$encoder = new BCryptPasswordEncoder(self::VALID_COST);
$result = $encoder->encodePassword(self::PASSWORD, null);
$this->assertEquals(60, strlen($result));
}
/**
* @requires PHP 5.3.7
*/
public function testValidation()
{
$this->skipIfPhpVersionIsNotSupported();
$encoder = new BCryptPasswordEncoder(self::VALID_COST);
$result = $encoder->encodePassword(self::PASSWORD, null);
$this->assertTrue($encoder->isPasswordValid($result, self::PASSWORD, null));
$this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null));
}
private function skipIfPhpVersionIsNotSupported()
{
if (PHP_VERSION_ID < 50307) {
$this->markTestSkipped('Requires PHP >= 5.3.7');
}
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
*/

View File

@ -13,11 +13,14 @@ namespace Symfony\Component\Validator\Tests\Mapping\Cache;
use Symfony\Component\Validator\Mapping\Cache\ApcCache;
/**
* @requires extension apc
*/
class ApcCacheTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (!ini_get('apc.enable') || !ini_get('apc.enable_cli')) {
if (!ini_get('apc.enabled') || !ini_get('apc.enable_cli')) {
$this->markTestSkipped('APC is not enabled.');
}
}