[tests] Use @requires annotation when possible
This commit is contained in:
parent
864a58faa3
commit
814d96165d
@ -307,13 +307,12 @@ class CommandTest extends \PHPUnit_Framework_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @dataProvider getSetCodeBindToClosureTests */
|
/**
|
||||||
|
* @dataProvider getSetCodeBindToClosureTests
|
||||||
|
* @requires PHP 5.4
|
||||||
|
*/
|
||||||
public function testSetCodeBindToClosure($previouslyBound, $expected)
|
public function testSetCodeBindToClosure($previouslyBound, $expected)
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 50400) {
|
|
||||||
$this->markTestSkipped('Test skipped, for PHP 5.4+ only.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$code = createClosure();
|
$code = createClosure();
|
||||||
if ($previouslyBound) {
|
if ($previouslyBound) {
|
||||||
$code = $code->bindTo($this);
|
$code = $code->bindTo($this);
|
||||||
|
@ -24,13 +24,10 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider spaceProvider
|
* @dataProvider spaceProvider
|
||||||
|
* @requires extension mbstring
|
||||||
*/
|
*/
|
||||||
public function testTrimUtf8Separators($hex)
|
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
|
// Convert hexadecimal representation into binary
|
||||||
// H: hex string, high nibble first (UCS-2BE)
|
// H: hex string, high nibble first (UCS-2BE)
|
||||||
// *: repeat until end of string
|
// *: repeat until end of string
|
||||||
|
@ -41,6 +41,7 @@ class MongoDbProfilerStorageTestDataCollector extends DataCollector
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
|
* @requires extension mongo
|
||||||
*/
|
*/
|
||||||
class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
|
class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
|
||||||
{
|
{
|
||||||
@ -131,10 +132,6 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
|
|||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
if (!extension_loaded('mongo')) {
|
|
||||||
$this->markTestSkipped('MongoDbProfilerStorageTest requires the mongo PHP extension and a MongoDB server on localhost');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->storage = new MongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400);
|
$this->storage = new MongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400);
|
||||||
$m = new \ReflectionMethod($this->storage, 'getMongo');
|
$m = new \ReflectionMethod($this->storage, 'getMongo');
|
||||||
$m->setAccessible(true);
|
$m->setAccessible(true);
|
||||||
|
@ -15,6 +15,7 @@ use Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
|
* @requires extensin pdo_sqlite
|
||||||
*/
|
*/
|
||||||
class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
|
class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
|
||||||
{
|
{
|
||||||
@ -23,10 +24,6 @@ class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
|
|||||||
|
|
||||||
protected function setUp()
|
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');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->dbFile = tempnam(sys_get_temp_dir(), 'sf2_sqlite_storage');
|
$this->dbFile = tempnam(sys_get_temp_dir(), 'sf2_sqlite_storage');
|
||||||
if (file_exists($this->dbFile)) {
|
if (file_exists($this->dbFile)) {
|
||||||
@unlink($this->dbFile);
|
@unlink($this->dbFile);
|
||||||
|
@ -13,15 +13,11 @@ namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
|||||||
|
|
||||||
use Symfony\Component\Ldap\LdapClient;
|
use Symfony\Component\Ldap\LdapClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @requires extension ldap
|
||||||
|
*/
|
||||||
class LdapClientTest extends \PHPUnit_Framework_TestCase
|
class LdapClientTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
if (!extension_loaded('ldap')) {
|
|
||||||
$this->markTestSkipped('The ldap extension is not available');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideLdapEscapeValues
|
* @dataProvider provideLdapEscapeValues
|
||||||
*/
|
*/
|
||||||
|
@ -75,13 +75,10 @@ class ReflectionExtractorTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider php7TypesProvider
|
* @dataProvider php7TypesProvider
|
||||||
|
* @requires PHP 7.0
|
||||||
*/
|
*/
|
||||||
public function testExtractPhp7Type($property, array $type = null)
|
public function testExtractPhp7Type($property, array $type = null)
|
||||||
{
|
{
|
||||||
if (!method_exists('\ReflectionMethod', 'getReturnType')) {
|
|
||||||
$this->markTestSkipped('Available only with PHP 7 and superior.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assertEquals($type, $this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\Php7Dummy', $property, array()));
|
$this->assertEquals($type, $this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\Php7Dummy', $property, array()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,9 @@ use Symfony\Component\Translation\Dumper\IcuResFileDumper;
|
|||||||
|
|
||||||
class IcuResFileDumperTest extends \PHPUnit_Framework_TestCase
|
class IcuResFileDumperTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @requires extension mbstring
|
||||||
|
*/
|
||||||
public function testFormatCatalogue()
|
public function testFormatCatalogue()
|
||||||
{
|
{
|
||||||
if (!function_exists('mb_convert_encoding')) {
|
if (!function_exists('mb_convert_encoding')) {
|
||||||
|
Reference in New Issue
Block a user