Skip to content

Commit

Permalink
Fix SkippedTestSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
jderusse authored and fabpot committed Jul 4, 2021
1 parent fc4d960 commit 246f802
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Tests/Store/MemcachedStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Lock\Tests\Store;

use PHPUnit\Framework\SkippedTestSuiteError;
use Symfony\Component\Lock\Exception\InvalidTtlException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;
Expand All @@ -34,7 +35,7 @@ public static function setUpBeforeClass(): void
$code = $memcached->getResultCode();

if (\Memcached::RES_SUCCESS !== $code && \Memcached::RES_NOTFOUND !== $code) {
self::markTestSkipped('Unable to connect to the memcache host');
throw new SkippedTestSuiteError('Unable to connect to the memcache host');
}
}

Expand Down
4 changes: 3 additions & 1 deletion Tests/Store/PredisStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Component\Lock\Tests\Store;

use PHPUnit\Framework\SkippedTestSuiteError;

/**
* @author Jérémy Derussé <[email protected]>
* @group integration
Expand All @@ -23,7 +25,7 @@ public static function setUpBeforeClass(): void
try {
$redis->connect();
} catch (\Exception $e) {
self::markTestSkipped($e->getMessage());
throw new SkippedTestSuiteError($e->getMessage());
}
}

Expand Down
6 changes: 4 additions & 2 deletions Tests/Store/RedisArrayStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Component\Lock\Tests\Store;

use PHPUnit\Framework\SkippedTestSuiteError;

/**
* @author Jérémy Derussé <[email protected]>
*
Expand All @@ -22,12 +24,12 @@ class RedisArrayStoreTest extends AbstractRedisStoreTest
public static function setUpBeforeClass(): void
{
if (!class_exists(\RedisArray::class)) {
self::markTestSkipped('The RedisArray class is required.');
throw new SkippedTestSuiteError('The RedisArray class is required.');
}
try {
(new \Redis())->connect(getenv('REDIS_HOST'));
} catch (\Exception $e) {
self::markTestSkipped($e->getMessage());
throw new SkippedTestSuiteError($e->getMessage());
}
}

Expand Down
6 changes: 4 additions & 2 deletions Tests/Store/RedisClusterStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Component\Lock\Tests\Store;

use PHPUnit\Framework\SkippedTestSuiteError;

/**
* @author Jérémy Derussé <[email protected]>
*
Expand All @@ -22,10 +24,10 @@ class RedisClusterStoreTest extends AbstractRedisStoreTest
public static function setUpBeforeClass(): void
{
if (!class_exists(\RedisCluster::class)) {
self::markTestSkipped('The RedisCluster class is required.');
throw new SkippedTestSuiteError('The RedisCluster class is required.');
}
if (!getenv('REDIS_CLUSTER_HOSTS')) {
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
throw new SkippedTestSuiteError('REDIS_CLUSTER_HOSTS env var is not defined.');
}
}

Expand Down
3 changes: 2 additions & 1 deletion Tests/Store/RedisStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Lock\Tests\Store;

use PHPUnit\Framework\SkippedTestSuiteError;
use Symfony\Component\Lock\Exception\InvalidTtlException;
use Symfony\Component\Lock\Store\RedisStore;

Expand All @@ -27,7 +28,7 @@ public static function setUpBeforeClass(): void
try {
(new \Redis())->connect(getenv('REDIS_HOST'));
} catch (\Exception $e) {
self::markTestSkipped($e->getMessage());
throw new SkippedTestSuiteError($e->getMessage());
}
}

Expand Down

0 comments on commit 246f802

Please sign in to comment.