diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php index 7f7a0ae15c..483fd65e27 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php @@ -13,15 +13,11 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor; use Symfony\Bundle\FrameworkBundle\Console\Descriptor\JsonDescriptor; +/** + * @requires PHP 5.4 + */ class JsonDescriptorTest extends AbstractDescriptorTest { - protected function setUp() - { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('Test skipped on PHP 5.3 as JSON_PRETTY_PRINT does not exist.'); - } - } - protected function getDescriptor() { return new JsonDescriptor(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index db8c8cd689..9f2482d5ad 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -291,13 +291,10 @@ abstract class FrameworkExtensionTest extends TestCase /** * @group legacy + * @requires extension apc */ public function testLegacyFullyConfiguredValidationService() { - if (!extension_loaded('apc')) { - $this->markTestSkipped('The apc extension is not available.'); - } - $container = $this->createContainerFromFile('full'); $this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $container->get('validator')); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php index 9a8b5e2e97..db4c51c5f0 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SetAclCommandTest.php @@ -33,6 +33,7 @@ use Symfony\Component\Security\Acl\Permission\BasicPermissionMap; * Tests SetAclCommand. * * @author Kévin Dunglas + * @requires extension pdo_sqlite */ class SetAclCommandTest extends WebTestCase { @@ -41,9 +42,6 @@ class SetAclCommandTest extends WebTestCase protected function setUp() { - if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { - self::markTestSkipped('This test requires SQLite support in your environment'); - } parent::setUp(); $this->deleteTmpDir('Acl'); diff --git a/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php new file mode 100644 index 0000000000..8090c5e175 --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php @@ -0,0 +1,199 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\ClassLoader\Tests; + +use Symfony\Component\ClassLoader\ApcClassLoader; +use Symfony\Component\ClassLoader\ClassLoader; + +/** + * @requires extension apc + */ +class ApcClassLoaderTest 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 { + apc_clear_cache('user'); + } + } + + protected function tearDown() + { + if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) { + apc_clear_cache('user'); + } + } + + public function testConstructor() + { + $loader = new ClassLoader(); + $loader->addPrefix('Apc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + + $loader = new ApcClassLoader('test.prefix.', $loader); + + $this->assertEquals($loader->findFile('\Apc\Namespaced\FooBar'), apc_fetch('test.prefix.\Apc\Namespaced\FooBar'), '__construct() takes a prefix as its first argument'); + } + + /** + * @dataProvider getLoadClassTests + */ + public function testLoadClass($className, $testClassName, $message) + { + $loader = new ClassLoader(); + $loader->addPrefix('Apc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + $loader->addPrefix('Apc_Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + + $loader = new ApcClassLoader('test.prefix.', $loader); + $loader->loadClass($testClassName); + $this->assertTrue(class_exists($className), $message); + } + + public function getLoadClassTests() + { + return array( + array('\\Apc\\Namespaced\\Foo', 'Apc\\Namespaced\\Foo', '->loadClass() loads Apc\Namespaced\Foo class'), + array('Apc_Pearlike_Foo', 'Apc_Pearlike_Foo', '->loadClass() loads Apc_Pearlike_Foo class'), + ); + } + + /** + * @dataProvider getLoadClassFromFallbackTests + */ + public function testLoadClassFromFallback($className, $testClassName, $message) + { + $loader = new ClassLoader(); + $loader->addPrefix('Apc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + $loader->addPrefix('Apc_Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + $loader->addPrefix('', array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/fallback')); + + $loader = new ApcClassLoader('test.prefix.fallback', $loader); + $loader->loadClass($testClassName); + + $this->assertTrue(class_exists($className), $message); + } + + public function getLoadClassFromFallbackTests() + { + return array( + array('\\Apc\\Namespaced\\Baz', 'Apc\\Namespaced\\Baz', '->loadClass() loads Apc\Namespaced\Baz class'), + array('Apc_Pearlike_Baz', 'Apc_Pearlike_Baz', '->loadClass() loads Apc_Pearlike_Baz class'), + array('\\Apc\\Namespaced\\FooBar', 'Apc\\Namespaced\\FooBar', '->loadClass() loads Apc\Namespaced\Baz class from fallback dir'), + array('Apc_Pearlike_FooBar', 'Apc_Pearlike_FooBar', '->loadClass() loads Apc_Pearlike_Baz class from fallback dir'), + ); + } + + /** + * @dataProvider getLoadClassNamespaceCollisionTests + */ + public function testLoadClassNamespaceCollision($namespaces, $className, $message) + { + $loader = new ClassLoader(); + $loader->addPrefixes($namespaces); + + $loader = new ApcClassLoader('test.prefix.collision.', $loader); + $loader->loadClass($className); + + $this->assertTrue(class_exists($className), $message); + } + + public function getLoadClassNamespaceCollisionTests() + { + return array( + array( + array( + 'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', + 'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', + ), + 'Apc\NamespaceCollision\A\Foo', + '->loadClass() loads NamespaceCollision\A\Foo from alpha.', + ), + array( + array( + 'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', + 'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', + ), + 'Apc\NamespaceCollision\A\Bar', + '->loadClass() loads NamespaceCollision\A\Bar from alpha.', + ), + array( + array( + 'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', + 'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', + ), + 'Apc\NamespaceCollision\A\B\Foo', + '->loadClass() loads NamespaceCollision\A\B\Foo from beta.', + ), + array( + array( + 'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', + 'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', + ), + 'Apc\NamespaceCollision\A\B\Bar', + '->loadClass() loads NamespaceCollision\A\B\Bar from beta.', + ), + ); + } + + /** + * @dataProvider getLoadClassPrefixCollisionTests + */ + public function testLoadClassPrefixCollision($prefixes, $className, $message) + { + $loader = new ClassLoader(); + $loader->addPrefixes($prefixes); + + $loader = new ApcClassLoader('test.prefix.collision.', $loader); + $loader->loadClass($className); + + $this->assertTrue(class_exists($className), $message); + } + + public function getLoadClassPrefixCollisionTests() + { + return array( + array( + array( + 'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', + 'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', + ), + 'ApcPrefixCollision_A_Foo', + '->loadClass() loads ApcPrefixCollision_A_Foo from alpha.', + ), + array( + array( + 'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', + 'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', + ), + 'ApcPrefixCollision_A_Bar', + '->loadClass() loads ApcPrefixCollision_A_Bar from alpha.', + ), + array( + array( + 'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', + 'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', + ), + 'ApcPrefixCollision_A_B_Foo', + '->loadClass() loads ApcPrefixCollision_A_B_Foo from beta.', + ), + array( + array( + 'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', + 'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', + ), + 'ApcPrefixCollision_A_B_Bar', + '->loadClass() loads ApcPrefixCollision_A_B_Bar from beta.', + ), + ); + } +} diff --git a/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php index 0268a1c456..36ae82a6d7 100644 --- a/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php @@ -15,6 +15,7 @@ use Symfony\Component\ClassLoader\ApcUniversalClassLoader; /** * @group legacy + * @requires extension apc */ class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index d33e5848bd..1aa5711635 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -1002,12 +1002,11 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $this->assertEquals('interact called'.PHP_EOL.'called'.PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command'); } + /** + * @requires function posix_isatty + */ public function testCanCheckIfTerminalIsInteractive() { - if (!function_exists('posix_isatty')) { - $this->markTestSkipped('posix_isatty function is required'); - } - $application = new CustomDefaultCommandApplication(); $application->setAutoExit(false); diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php index 21fdca0962..78f537543e 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php @@ -270,12 +270,11 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase $bar->advance(1); } + /** + * @requires extension mbstring + */ public function testMultiByteSupport() { - if (!function_exists('mb_strlen') || (false === $encoding = mb_detect_encoding('■'))) { - $this->markTestSkipped('The mbstring extension is needed for multi-byte support'); - } - $bar = new ProgressBar($output = $this->getOutputStream()); $bar->start(); $bar->setBarCharacter('■'); diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index ad05379401..19bdf00e06 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -464,12 +464,11 @@ TABLE ); } + /** + * @requires extension mbstring + */ public function testRenderMultiByte() { - if (!function_exists('mb_strlen')) { - $this->markTestSkipped('The "mbstring" extension is not available'); - } - $table = new Table($output = $this->getOutputStream()); $table ->setHeaders(array('■■')) diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php index 6e112bb7ff..aed8cdfe1a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php @@ -19,10 +19,6 @@ class MergeExtensionConfigurationPassTest extends \PHPUnit_Framework_TestCase { public function testExpressionLanguageProviderForwarding() { - if (true !== class_exists('Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) { - $this->markTestSkipped('The ExpressionLanguage component isn\'t available!'); - } - $tmpProviders = array(); $extension = $this->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface'); diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php index 0ef9c8dddd..cb60736b40 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php @@ -95,25 +95,25 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase protected function markAsSkippedIfSymlinkIsMissing() { if (!function_exists('symlink')) { - $this->markTestSkipped('symlink is not supported'); + $this->markTestSkipped('Function symlink is required.'); } if ('\\' === DIRECTORY_SEPARATOR && false === self::$symlinkOnWindows) { - $this->markTestSkipped('symlink requires "Create symbolic links" privilege on windows'); + $this->markTestSkipped('symlink requires "Create symbolic links" privilege on Windows'); } } protected function markAsSkippedIfChmodIsMissing() { if ('\\' === DIRECTORY_SEPARATOR) { - $this->markTestSkipped('chmod is not supported on windows'); + $this->markTestSkipped('chmod is not supported on Windows'); } } protected function markAsSkippedIfPosixIsMissing() { - if ('\\' === DIRECTORY_SEPARATOR || !function_exists('posix_isatty')) { - $this->markTestSkipped('Posix is not supported'); + if (!function_exists('posix_isatty')) { + $this->markTestSkipped('Function posix_isatty is required.'); } } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php index f1ea565700..60d27e4d59 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php @@ -205,13 +205,10 @@ class JsonResponseTest extends \PHPUnit_Framework_TestCase /** * @expectedException \Exception * @expectedExceptionMessage This error is expected + * @requires PHP 5.4 */ public function testSetContentJsonSerializeError() { - if (!interface_exists('JsonSerializable')) { - $this->markTestSkipped('Interface JsonSerializable is available in PHP 5.4+'); - } - $serializable = new JsonSerializableObject(); JsonResponse::create($serializable); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php index 7a1e491dc1..cfc9cfc85f 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php @@ -15,6 +15,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\LegacyPdoSessionHan /** * @group legacy + * @requires extension pdo_sqlite */ class LegacyPdoSessionHandlerTest extends \PHPUnit_Framework_TestCase { @@ -22,10 +23,6 @@ class LegacyPdoSessionHandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { - $this->markTestSkipped('This test requires SQLite support in your environment'); - } - $this->pdo = new \PDO('sqlite::memory:'); $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $sql = 'CREATE TABLE sessions (sess_id VARCHAR(128) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)'; diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php index 8d3ddb4e5d..2f2bb972da 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php @@ -31,12 +31,11 @@ class ValueExporterTest extends \PHPUnit_Framework_TestCase $this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime)); } + /** + * @requires PHP 5.5 + */ public function testDateTimeImmutable() { - if (!class_exists('DateTimeImmutable', false)) { - $this->markTestSkipped('Test skipped, class DateTimeImmutable does not exist.'); - } - $dateTime = new \DateTimeImmutable('2014-06-10 07:35:40', new \DateTimeZone('UTC')); $this->assertSame('Object(DateTimeImmutable) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime)); } diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php index 0039deb1a8..7d3a537902 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php @@ -50,12 +50,11 @@ class NativeSessionTokenStorageTest extends \PHPUnit_Framework_TestCase $this->assertSame(array(self::SESSION_NAMESPACE => array('token_id' => 'TOKEN')), $_SESSION); } + /** + * @requires PHP 5.4 + */ public function testStoreTokenInClosedSessionWithExistingSessionId() { - if (PHP_VERSION_ID < 50400) { - $this->markTestSkipped('This test requires PHP 5.4 or later.'); - } - session_id('foobar'); $this->assertSame(PHP_SESSION_NONE, session_status()); diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php index 4166c1eb4a..0eac0a8aa0 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php @@ -32,10 +32,6 @@ class SessionTokenStorageTest extends \PHPUnit_Framework_TestCase protected function setUp() { - if (!interface_exists('Symfony\Component\HttpFoundation\Session\SessionInterface')) { - $this->markTestSkipped('The "HttpFoundation" component is not available'); - } - $this->session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface') ->disableOriginalConstructor() ->getMock(); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index 53369629e6..3baf58703f 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -207,11 +207,13 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array(1, 2, 3), $obj->getBaz()); } + /** + * @see https://bugs.php.net/62715 + * + * @requires PHP 5.3.17 + */ public function testConstructorDenormalizeWithOptionalDefaultArgument() { - if (PHP_VERSION_ID <= 50316) { - $this->markTestSkipped('See https://bugs.php.net/62715'); - } $obj = $this->normalizer->denormalize( array('bar' => 'test'), __NAMESPACE__.'\GetConstructorArgsWithDefaultValueDummy', 'any'); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php index 3080c8df80..1cadee52b1 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php @@ -155,11 +155,13 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array(1, 2, 3), $obj->getBaz()); } + /** + * @see https://bugs.php.net/62715 + * + * @requires PHP 5.3.17 + */ public function testConstructorDenormalizeWithOptionalDefaultArgument() { - if (PHP_VERSION_ID <= 50316) { - $this->markTestSkipped('See https://bugs.php.net/62715'); - } $obj = $this->normalizer->denormalize( array('bar' => 'test'), __NAMESPACE__.'\ObjectConstructorArgsWithDefaultValueDummy', 'any'); diff --git a/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php b/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php index 8e98ad31f4..6031f75680 100644 --- a/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php @@ -17,12 +17,6 @@ use Symfony\Component\Translation\Loader\ArrayLoader; class DataCollectorTranslatorTest extends \PHPUnit_Framework_TestCase { - protected function setUp() - { - if (!class_exists('Symfony\Component\HttpKernel\DataCollector\DataCollector')) { - $this->markTestSkipped('The "DataCollector" is not available'); - } - } public function testCollectMessages() { $collector = $this->createCollector(); diff --git a/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php index 6d4f353bf7..cd5d6339f7 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/JsonFileLoaderTest.php @@ -16,13 +16,6 @@ use Symfony\Component\Config\Resource\FileResource; class JsonFileLoaderTest extends \PHPUnit_Framework_TestCase { - protected function setUp() - { - if (!class_exists('Symfony\Component\Config\Loader\Loader')) { - $this->markTestSkipped('The "Config" component is not available'); - } - } - public function testLoad() { $loader = new JsonFileLoader(); diff --git a/src/Symfony/Component/Translation/Tests/LoggingTranslatorTest.php b/src/Symfony/Component/Translation/Tests/LoggingTranslatorTest.php index ab98d72e74..9f3e849bf4 100644 --- a/src/Symfony/Component/Translation/Tests/LoggingTranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/LoggingTranslatorTest.php @@ -17,13 +17,6 @@ use Symfony\Component\Translation\Loader\ArrayLoader; class LoggingTranslatorTest extends \PHPUnit_Framework_TestCase { - protected function setUp() - { - if (!interface_exists('Psr\Log\LoggerInterface')) { - $this->markTestSkipped('The "LoggerInterface" is not available'); - } - } - public function testTransWithNoTranslationIsLogged() { $logger = $this->getMock('Psr\Log\LoggerInterface'); diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php index 9d39784280..bf16f9b985 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php @@ -15,6 +15,7 @@ use Symfony\Component\Validator\Mapping\Cache\ApcCache; /** * @group legacy + * @requires extension apc */ class LegacyApcCacheTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php index 445b712ec9..0642c53716 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php @@ -19,12 +19,11 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ class PdoCasterTest extends \PHPUnit_Framework_TestCase { + /** + * @requires extension pdo_sqlite + */ public function testCastPdo() { - if (!extension_loaded('pdo_sqlite')) { - $this->markTestSkipped('pdo_sqlite extension is required'); - } - $pdo = new \PDO('sqlite::memory:'); $pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array($pdo))); diff --git a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php index 316e3c61c5..3e19dc6f2e 100644 --- a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php @@ -115,12 +115,11 @@ EOTXT ); } + /** + * @requires extension xml + */ public function testXmlResource() { - if (!extension_loaded('xml')) { - $this->markTestSkipped('xml extension is required'); - } - $var = xml_parser_create(); $this->assertDumpMatchesFormat( @@ -257,13 +256,10 @@ EOTXT /** * @runInSeparateProcess * @preserveGlobalState disabled + * @requires PHP 5.6 */ public function testSpecialVars56() { - if (PHP_VERSION_ID < 50600) { - $this->markTestSkipped('PHP 5.6 is required'); - } - $var = $this->getSpecialVars(); $this->assertDumpEquals( diff --git a/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php b/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php index a6e909fb45..ae465a703f 100644 --- a/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/HtmlDumperTest.php @@ -120,11 +120,11 @@ EOTXT ); } + /** + * @requires extension mbstring + */ public function testCharset() { - if (!extension_loaded('mbstring')) { - $this->markTestSkipped('This test requires mbstring.'); - } $var = mb_convert_encoding('Словарь', 'CP1251', 'UTF-8'); $dumper = new HtmlDumper('php://output', 'CP1251');