Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c8475c9

Browse filesBrowse files
minor #16187 [2.8][tests] Use @requires annotation when possible (nicolas-grekas)
This PR was merged into the 2.8 branch. Discussion ---------- [2.8][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 ------- 814d961 [tests] Use @requires annotation when possible
2 parents 58475a1 + 814d961 commit c8475c9
Copy full SHA for c8475c9

File tree

Expand file treeCollapse file tree

6 files changed

+11
-28
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+11
-28
lines changed

‎src/Symfony/Component/Console/Tests/Command/CommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Command/CommandTest.php
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,12 @@ public function getSetCodeBindToClosureTests()
307307
);
308308
}
309309

310-
/** @dataProvider getSetCodeBindToClosureTests */
310+
/**
311+
* @dataProvider getSetCodeBindToClosureTests
312+
* @requires PHP 5.4
313+
*/
311314
public function testSetCodeBindToClosure($previouslyBound, $expected)
312315
{
313-
if (PHP_VERSION_ID < 50400) {
314-
$this->markTestSkipped('Test skipped, for PHP 5.4+ only.');
315-
}
316-
317316
$code = createClosure();
318317
if ($previouslyBound) {
319318
$code = $code->bindTo($this);

‎src/Symfony/Component/Form/Tests/Util/StringUtilTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Util/StringUtilTest.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@ public function testTrim()
2424

2525
/**
2626
* @dataProvider spaceProvider
27+
* @requires extension mbstring
2728
*/
2829
public function testTrimUtf8Separators($hex)
2930
{
30-
if (!function_exists('mb_convert_encoding')) {
31-
$this->markTestSkipped('The "mb_convert_encoding" function is not available');
32-
}
33-
3431
// Convert hexadecimal representation into binary
3532
// H: hex string, high nibble first (UCS-2BE)
3633
// *: repeat until end of string

‎src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function getName()
4141

4242
/**
4343
* @group legacy
44+
* @requires extension mongo
4445
*/
4546
class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
4647
{
@@ -131,10 +132,6 @@ protected function getStorage()
131132

132133
protected function setUp()
133134
{
134-
if (!extension_loaded('mongo')) {
135-
$this->markTestSkipped('MongoDbProfilerStorageTest requires the mongo PHP extension and a MongoDB server on localhost');
136-
}
137-
138135
$this->storage = new MongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400);
139136
$m = new \ReflectionMethod($this->storage, 'getMongo');
140137
$m->setAccessible(true);

‎src/Symfony/Component/HttpKernel/Tests/Profiler/SqliteProfilerStorageTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/Profiler/SqliteProfilerStorageTest.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
/**
1717
* @group legacy
18+
* @requires extensin pdo_sqlite
1819
*/
1920
class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
2021
{
@@ -23,10 +24,6 @@ class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
2324

2425
protected function setUp()
2526
{
26-
if (!class_exists('SQLite3') && (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers()))) {
27-
$this->markTestSkipped('This test requires SQLite support in your environment');
28-
}
29-
3027
$this->dbFile = tempnam(sys_get_temp_dir(), 'sf2_sqlite_storage');
3128
if (file_exists($this->dbFile)) {
3229
@unlink($this->dbFile);

‎src/Symfony/Component/Ldap/Tests/LdapClientTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Ldap/Tests/LdapClientTest.php
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,11 @@
1313

1414
use Symfony\Component\Ldap\LdapClient;
1515

16+
/**
17+
* @requires extension ldap
18+
*/
1619
class LdapClientTest extends \PHPUnit_Framework_TestCase
1720
{
18-
protected function setUp()
19-
{
20-
if (!extension_loaded('ldap')) {
21-
$this->markTestSkipped('The ldap extension is not available');
22-
}
23-
}
24-
2521
/**
2622
* @dataProvider provideLdapEscapeValues
2723
*/

‎src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,10 @@ public function typesProvider()
7575

7676
/**
7777
* @dataProvider php7TypesProvider
78+
* @requires PHP 7.0
7879
*/
7980
public function testExtractPhp7Type($property, array $type = null)
8081
{
81-
if (!method_exists('\ReflectionMethod', 'getReturnType')) {
82-
$this->markTestSkipped('Available only with PHP 7 and superior.');
83-
}
84-
8582
$this->assertEquals($type, $this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\Php7Dummy', $property, array()));
8683
}
8784

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.