Skip to content

Commit b0878f1

Browse files
digilistnicolas-grekas
authored andcommitted
Replace usages of SkippedTestSuiteError with markTestSkipped() call
1 parent 1d57d1a commit b0878f1

File tree

7 files changed

+11
-21
lines changed

7 files changed

+11
-21
lines changed

Tests/Store/MemcachedStoreTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Lock\Tests\Store;
1313

14-
use PHPUnit\Framework\SkippedTestSuiteError;
1514
use Symfony\Component\Lock\Exception\InvalidTtlException;
1615
use Symfony\Component\Lock\Key;
1716
use Symfony\Component\Lock\PersistingStoreInterface;
@@ -31,7 +30,7 @@ class MemcachedStoreTest extends AbstractStoreTestCase
3130
public static function setUpBeforeClass(): void
3231
{
3332
if (version_compare(phpversion('memcached'), '3.1.6', '<')) {
34-
throw new SkippedTestSuiteError('Extension memcached > 3.1.5 required.');
33+
self::markTestSkipped('Extension memcached > 3.1.5 required.');
3534
}
3635

3736
$memcached = new \Memcached();
@@ -40,7 +39,7 @@ public static function setUpBeforeClass(): void
4039
$code = $memcached->getResultCode();
4140

4241
if (\Memcached::RES_SUCCESS !== $code && \Memcached::RES_NOTFOUND !== $code) {
43-
throw new SkippedTestSuiteError('Unable to connect to the memcache host');
42+
self::markTestSkipped('Unable to connect to the memcache host');
4443
}
4544
}
4645

Tests/Store/MongoDbStoreTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use MongoDB\Client;
1515
use MongoDB\Driver\Exception\ConnectionTimeoutException;
16-
use PHPUnit\Framework\SkippedTestSuiteError;
1716
use Symfony\Component\Lock\Exception\InvalidArgumentException;
1817
use Symfony\Component\Lock\Key;
1918
use Symfony\Component\Lock\PersistingStoreInterface;
@@ -33,14 +32,14 @@ class MongoDbStoreTest extends AbstractStoreTestCase
3332
public static function setupBeforeClass(): void
3433
{
3534
if (!class_exists(\MongoDB\Client::class)) {
36-
throw new SkippedTestSuiteError('The mongodb/mongodb package is required.');
35+
self::markTestSkipped('The mongodb/mongodb package is required.');
3736
}
3837

3938
$client = self::getMongoClient();
4039
try {
4140
$client->listDatabases();
4241
} catch (ConnectionTimeoutException $e) {
43-
throw new SkippedTestSuiteError('MongoDB server not found.');
42+
self::markTestSkipped('MongoDB server not found.');
4443
}
4544
}
4645

Tests/Store/PredisStoreTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\Lock\Tests\Store;
1313

14-
use PHPUnit\Framework\SkippedTestSuiteError;
15-
1614
/**
1715
* @author Jérémy Derussé <jeremy@derusse.com>
1816
*
@@ -26,7 +24,7 @@ public static function setUpBeforeClass(): void
2624
try {
2725
$redis->connect();
2826
} catch (\Exception $e) {
29-
throw new SkippedTestSuiteError($e->getMessage());
27+
self::markTestSkipped($e->getMessage());
3028
}
3129
}
3230

Tests/Store/RedisArrayStoreTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\Lock\Tests\Store;
1313

14-
use PHPUnit\Framework\SkippedTestSuiteError;
15-
1614
/**
1715
* @author Jérémy Derussé <jeremy@derusse.com>
1816
*
@@ -25,12 +23,12 @@ class RedisArrayStoreTest extends AbstractRedisStoreTestCase
2523
public static function setUpBeforeClass(): void
2624
{
2725
if (!class_exists(\RedisArray::class)) {
28-
throw new SkippedTestSuiteError('The RedisArray class is required.');
26+
self::markTestSkipped('The RedisArray class is required.');
2927
}
3028
try {
3129
(new \Redis())->connect(...explode(':', getenv('REDIS_HOST')));
3230
} catch (\Exception $e) {
33-
throw new SkippedTestSuiteError($e->getMessage());
31+
self::markTestSkipped($e->getMessage());
3432
}
3533
}
3634

Tests/Store/RedisClusterStoreTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\Lock\Tests\Store;
1313

14-
use PHPUnit\Framework\SkippedTestSuiteError;
15-
1614
/**
1715
* @author Jérémy Derussé <jeremy@derusse.com>
1816
*
@@ -25,10 +23,10 @@ class RedisClusterStoreTest extends AbstractRedisStoreTestCase
2523
public static function setUpBeforeClass(): void
2624
{
2725
if (!class_exists(\RedisCluster::class)) {
28-
throw new SkippedTestSuiteError('The RedisCluster class is required.');
26+
self::markTestSkipped('The RedisCluster class is required.');
2927
}
3028
if (!getenv('REDIS_CLUSTER_HOSTS')) {
31-
throw new SkippedTestSuiteError('REDIS_CLUSTER_HOSTS env var is not defined.');
29+
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
3230
}
3331
}
3432

Tests/Store/RedisStoreTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Lock\Tests\Store;
1313

14-
use PHPUnit\Framework\SkippedTestSuiteError;
1514
use Symfony\Component\Lock\Exception\InvalidTtlException;
1615
use Symfony\Component\Lock\Store\RedisStore;
1716

@@ -31,7 +30,7 @@ public static function setUpBeforeClass(): void
3130
try {
3231
(new \Redis())->connect(...explode(':', getenv('REDIS_HOST')));
3332
} catch (\Exception $e) {
34-
throw new SkippedTestSuiteError($e->getMessage());
33+
self::markTestSkipped($e->getMessage());
3534
}
3635
}
3736

Tests/Store/RelayStoreTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Store;
1313

14-
use PHPUnit\Framework\SkippedTestSuiteError;
1514
use Relay\Relay;
1615
use Symfony\Component\Lock\Tests\Store\AbstractRedisStoreTestCase;
1716
use Symfony\Component\Lock\Tests\Store\SharedLockStoreTestTrait;
@@ -30,7 +29,7 @@ public static function setUpBeforeClass(): void
3029
try {
3130
new Relay(...explode(':', getenv('REDIS_HOST')));
3231
} catch (\Relay\Exception $e) {
33-
throw new SkippedTestSuiteError($e->getMessage());
32+
self::markTestSkipped($e->getMessage());
3433
}
3534
}
3635

0 commit comments

Comments
 (0)