minor #16186 [2.7][tests] Use @requires annotation when possible (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[2.7][tests] Use @requires annotation when possible

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

Commits
-------

b028aea [tests] Use @requires annotation when possible
This commit is contained in:
Nicolas Grekas 2015-10-10 11:27:33 +02:00
commit 52dbc3b7cc
23 changed files with 247 additions and 96 deletions

View File

@ -13,15 +13,11 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor;
use Symfony\Bundle\FrameworkBundle\Console\Descriptor\JsonDescriptor; use Symfony\Bundle\FrameworkBundle\Console\Descriptor\JsonDescriptor;
/**
* @requires PHP 5.4
*/
class JsonDescriptorTest extends AbstractDescriptorTest 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() protected function getDescriptor()
{ {
return new JsonDescriptor(); return new JsonDescriptor();

View File

@ -291,13 +291,10 @@ abstract class FrameworkExtensionTest extends TestCase
/** /**
* @group legacy * @group legacy
* @requires extension apc
*/ */
public function testLegacyFullyConfiguredValidationService() public function testLegacyFullyConfiguredValidationService()
{ {
if (!extension_loaded('apc')) {
$this->markTestSkipped('The apc extension is not available.');
}
$container = $this->createContainerFromFile('full'); $container = $this->createContainerFromFile('full');
$this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $container->get('validator')); $this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $container->get('validator'));

View File

@ -33,6 +33,7 @@ use Symfony\Component\Security\Acl\Permission\BasicPermissionMap;
* Tests SetAclCommand. * Tests SetAclCommand.
* *
* @author Kévin Dunglas <kevin@les-tilleuls.coop> * @author Kévin Dunglas <kevin@les-tilleuls.coop>
* @requires extension pdo_sqlite
*/ */
class SetAclCommandTest extends WebTestCase class SetAclCommandTest extends WebTestCase
{ {
@ -41,9 +42,6 @@ class SetAclCommandTest extends WebTestCase
protected function setUp() protected function setUp()
{ {
if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) {
self::markTestSkipped('This test requires SQLite support in your environment');
}
parent::setUp(); parent::setUp();
$this->deleteTmpDir('Acl'); $this->deleteTmpDir('Acl');

View File

@ -0,0 +1,199 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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.',
),
);
}
}

View File

@ -1001,12 +1001,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'); $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() public function testCanCheckIfTerminalIsInteractive()
{ {
if (!function_exists('posix_isatty')) {
$this->markTestSkipped('posix_isatty function is required');
}
$application = new CustomDefaultCommandApplication(); $application = new CustomDefaultCommandApplication();
$application->setAutoExit(false); $application->setAutoExit(false);

View File

@ -270,12 +270,11 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
$bar->advance(1); $bar->advance(1);
} }
/**
* @requires extension mbstring
*/
public function testMultiByteSupport() 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 = new ProgressBar($output = $this->getOutputStream());
$bar->start(); $bar->start();
$bar->setBarCharacter('■'); $bar->setBarCharacter('■');

View File

@ -464,12 +464,11 @@ TABLE
); );
} }
/**
* @requires extension mbstring
*/
public function testRenderMultiByte() public function testRenderMultiByte()
{ {
if (!function_exists('mb_strlen')) {
$this->markTestSkipped('The "mbstring" extension is not available');
}
$table = new Table($output = $this->getOutputStream()); $table = new Table($output = $this->getOutputStream());
$table $table
->setHeaders(array('■■')) ->setHeaders(array('■■'))

View File

@ -19,10 +19,6 @@ class MergeExtensionConfigurationPassTest extends \PHPUnit_Framework_TestCase
{ {
public function testExpressionLanguageProviderForwarding() public function testExpressionLanguageProviderForwarding()
{ {
if (true !== class_exists('Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage')) {
$this->markTestSkipped('The ExpressionLanguage component isn\'t available!');
}
$tmpProviders = array(); $tmpProviders = array();
$extension = $this->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface'); $extension = $this->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface');

View File

@ -95,25 +95,25 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
protected function markAsSkippedIfSymlinkIsMissing() protected function markAsSkippedIfSymlinkIsMissing()
{ {
if (!function_exists('symlink')) { if (!function_exists('symlink')) {
$this->markTestSkipped('symlink is not supported'); $this->markTestSkipped('Function symlink is required.');
} }
if ('\\' === DIRECTORY_SEPARATOR && false === self::$symlinkOnWindows) { 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() protected function markAsSkippedIfChmodIsMissing()
{ {
if ('\\' === DIRECTORY_SEPARATOR) { if ('\\' === DIRECTORY_SEPARATOR) {
$this->markTestSkipped('chmod is not supported on windows'); $this->markTestSkipped('chmod is not supported on Windows');
} }
} }
protected function markAsSkippedIfPosixIsMissing() protected function markAsSkippedIfPosixIsMissing()
{ {
if ('\\' === DIRECTORY_SEPARATOR || !function_exists('posix_isatty')) { if (!function_exists('posix_isatty')) {
$this->markTestSkipped('Posix is not supported'); $this->markTestSkipped('Function posix_isatty is required.');
} }
} }
} }

View File

@ -205,13 +205,10 @@ class JsonResponseTest extends \PHPUnit_Framework_TestCase
/** /**
* @expectedException \Exception * @expectedException \Exception
* @expectedExceptionMessage This error is expected * @expectedExceptionMessage This error is expected
* @requires PHP 5.4
*/ */
public function testSetContentJsonSerializeError() public function testSetContentJsonSerializeError()
{ {
if (!interface_exists('JsonSerializable')) {
$this->markTestSkipped('Interface JsonSerializable is available in PHP 5.4+');
}
$serializable = new JsonSerializableObject(); $serializable = new JsonSerializableObject();
JsonResponse::create($serializable); JsonResponse::create($serializable);

View File

@ -15,6 +15,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\LegacyPdoSessionHan
/** /**
* @group legacy * @group legacy
* @requires extension pdo_sqlite
*/ */
class LegacyPdoSessionHandlerTest extends \PHPUnit_Framework_TestCase class LegacyPdoSessionHandlerTest extends \PHPUnit_Framework_TestCase
{ {
@ -22,10 +23,6 @@ class LegacyPdoSessionHandlerTest extends \PHPUnit_Framework_TestCase
protected function setUp() 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 = new \PDO('sqlite::memory:');
$this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $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)'; $sql = 'CREATE TABLE sessions (sess_id VARCHAR(128) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)';

View File

@ -31,12 +31,11 @@ class ValueExporterTest extends \PHPUnit_Framework_TestCase
$this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime)); $this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime));
} }
/**
* @requires PHP 5.5
*/
public function testDateTimeImmutable() 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')); $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)); $this->assertSame('Object(DateTimeImmutable) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime));
} }

View File

@ -50,12 +50,11 @@ class NativeSessionTokenStorageTest extends \PHPUnit_Framework_TestCase
$this->assertSame(array(self::SESSION_NAMESPACE => array('token_id' => 'TOKEN')), $_SESSION); $this->assertSame(array(self::SESSION_NAMESPACE => array('token_id' => 'TOKEN')), $_SESSION);
} }
/**
* @requires PHP 5.4
*/
public function testStoreTokenInClosedSessionWithExistingSessionId() public function testStoreTokenInClosedSessionWithExistingSessionId()
{ {
if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('This test requires PHP 5.4 or later.');
}
session_id('foobar'); session_id('foobar');
$this->assertSame(PHP_SESSION_NONE, session_status()); $this->assertSame(PHP_SESSION_NONE, session_status());

View File

@ -32,10 +32,6 @@ class SessionTokenStorageTest extends \PHPUnit_Framework_TestCase
protected function setUp() 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') $this->session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();

View File

@ -207,11 +207,13 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(1, 2, 3), $obj->getBaz()); $this->assertEquals(array(1, 2, 3), $obj->getBaz());
} }
/**
* @see https://bugs.php.net/62715
*
* @requires PHP 5.3.17
*/
public function testConstructorDenormalizeWithOptionalDefaultArgument() public function testConstructorDenormalizeWithOptionalDefaultArgument()
{ {
if (PHP_VERSION_ID <= 50316) {
$this->markTestSkipped('See https://bugs.php.net/62715');
}
$obj = $this->normalizer->denormalize( $obj = $this->normalizer->denormalize(
array('bar' => 'test'), array('bar' => 'test'),
__NAMESPACE__.'\GetConstructorArgsWithDefaultValueDummy', 'any'); __NAMESPACE__.'\GetConstructorArgsWithDefaultValueDummy', 'any');

View File

@ -155,11 +155,13 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(1, 2, 3), $obj->getBaz()); $this->assertEquals(array(1, 2, 3), $obj->getBaz());
} }
/**
* @see https://bugs.php.net/62715
*
* @requires PHP 5.3.17
*/
public function testConstructorDenormalizeWithOptionalDefaultArgument() public function testConstructorDenormalizeWithOptionalDefaultArgument()
{ {
if (PHP_VERSION_ID <= 50316) {
$this->markTestSkipped('See https://bugs.php.net/62715');
}
$obj = $this->normalizer->denormalize( $obj = $this->normalizer->denormalize(
array('bar' => 'test'), array('bar' => 'test'),
__NAMESPACE__.'\ObjectConstructorArgsWithDefaultValueDummy', 'any'); __NAMESPACE__.'\ObjectConstructorArgsWithDefaultValueDummy', 'any');

View File

@ -17,12 +17,6 @@ use Symfony\Component\Translation\Loader\ArrayLoader;
class DataCollectorTranslatorTest extends \PHPUnit_Framework_TestCase 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() public function testCollectMessages()
{ {
$collector = $this->createCollector(); $collector = $this->createCollector();

View File

@ -16,13 +16,6 @@ use Symfony\Component\Config\Resource\FileResource;
class JsonFileLoaderTest extends \PHPUnit_Framework_TestCase 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() public function testLoad()
{ {
$loader = new JsonFileLoader(); $loader = new JsonFileLoader();

View File

@ -17,13 +17,6 @@ use Symfony\Component\Translation\Loader\ArrayLoader;
class LoggingTranslatorTest extends \PHPUnit_Framework_TestCase 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() public function testTransWithNoTranslationIsLogged()
{ {
$logger = $this->getMock('Psr\Log\LoggerInterface'); $logger = $this->getMock('Psr\Log\LoggerInterface');

View File

@ -15,6 +15,7 @@ use Symfony\Component\Validator\Mapping\Cache\ApcCache;
/** /**
* @group legacy * @group legacy
* @requires extension apc
*/ */
class LegacyApcCacheTest extends \PHPUnit_Framework_TestCase class LegacyApcCacheTest extends \PHPUnit_Framework_TestCase
{ {

View File

@ -19,12 +19,11 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/ */
class PdoCasterTest extends \PHPUnit_Framework_TestCase class PdoCasterTest extends \PHPUnit_Framework_TestCase
{ {
/**
* @requires extension pdo_sqlite
*/
public function testCastPdo() public function testCastPdo()
{ {
if (!extension_loaded('pdo_sqlite')) {
$this->markTestSkipped('pdo_sqlite extension is required');
}
$pdo = new \PDO('sqlite::memory:'); $pdo = new \PDO('sqlite::memory:');
$pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array($pdo))); $pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array($pdo)));

View File

@ -115,12 +115,11 @@ EOTXT
); );
} }
/**
* @requires extension xml
*/
public function testXmlResource() public function testXmlResource()
{ {
if (!extension_loaded('xml')) {
$this->markTestSkipped('xml extension is required');
}
$var = xml_parser_create(); $var = xml_parser_create();
$this->assertDumpMatchesFormat( $this->assertDumpMatchesFormat(
@ -257,13 +256,10 @@ EOTXT
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled * @preserveGlobalState disabled
* @requires PHP 5.6
*/ */
public function testSpecialVars56() public function testSpecialVars56()
{ {
if (PHP_VERSION_ID < 50600) {
$this->markTestSkipped('PHP 5.6 is required');
}
$var = $this->getSpecialVars(); $var = $this->getSpecialVars();
$this->assertDumpEquals( $this->assertDumpEquals(

View File

@ -120,11 +120,11 @@ EOTXT
); );
} }
/**
* @requires extension mbstring
*/
public function testCharset() public function testCharset()
{ {
if (!extension_loaded('mbstring')) {
$this->markTestSkipped('This test requires mbstring.');
}
$var = mb_convert_encoding('Словарь', 'CP1251', 'UTF-8'); $var = mb_convert_encoding('Словарь', 'CP1251', 'UTF-8');
$dumper = new HtmlDumper('php://output', 'CP1251'); $dumper = new HtmlDumper('php://output', 'CP1251');