Skip to content

Replace usages of SkippedTestSuiteError with markTestSkipped() call #51776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;
use Psr\Cache\CacheItemPoolInterface;
use Relay\Relay;
use Symfony\Component\Cache\Adapter\RedisAdapter;
Expand All @@ -34,12 +33,12 @@ public function createCachePool(int $defaultLifetime = 0, string $testMethod = n
public static function setUpBeforeClass(): void
{
if (!\extension_loaded('redis')) {
throw new SkippedTestSuiteError('Extension redis required.');
self::markTestSkipped('Extension redis required.');
}
try {
(new \Redis())->connect(...explode(':', getenv('REDIS_HOST')));
} catch (\Exception $e) {
throw new SkippedTestSuiteError(getenv('REDIS_HOST').': '.$e->getMessage());
self::markTestSkipped(getenv('REDIS_HOST').': '.$e->getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\CouchbaseBucketAdapter;
Expand All @@ -35,7 +34,7 @@ class CouchbaseBucketAdapterTest extends AdapterTestCase
public static function setupBeforeClass(): void
{
if (!CouchbaseBucketAdapter::isSupported()) {
throw new SkippedTestSuiteError('Couchbase >= 2.6.0 < 3.0.0 is required.');
self::markTestSkipped('Couchbase >= 2.6.0 < 3.0.0 is required.');
}

self::$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
use Doctrine\DBAL\Schema\Schema;
use PHPUnit\Framework\SkippedTestSuiteError;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\DoctrineDbalAdapter;
use Symfony\Component\Cache\Tests\Fixtures\DriverWrapper;
Expand All @@ -33,7 +32,7 @@ class DoctrineDbalAdapterTest extends AdapterTestCase
public static function setUpBeforeClass(): void
{
if (!\extension_loaded('pdo_sqlite')) {
throw new SkippedTestSuiteError('Extension pdo_sqlite required.');
self::markTestSkipped('Extension pdo_sqlite required.');
}

self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\MemcachedAdapter;
Expand All @@ -33,14 +32,14 @@ class MemcachedAdapterTest extends AdapterTestCase
public static function setUpBeforeClass(): void
{
if (!MemcachedAdapter::isSupported()) {
throw new SkippedTestSuiteError('Extension memcached > 3.1.5 required.');
self::markTestSkipped('Extension memcached > 3.1.5 required.');
}
self::$client = AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['binary_protocol' => false]);
self::$client->get('foo');
$code = self::$client->getResultCode();

if (\Memcached::RES_SUCCESS !== $code && \Memcached::RES_NOTFOUND !== $code) {
throw new SkippedTestSuiteError('Memcached error: '.strtolower(self::$client->getResultMessage()));
self::markTestSkipped('Memcached error: '.strtolower(self::$client->getResultMessage()));
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\PdoAdapter;

Expand All @@ -25,7 +24,7 @@ class PdoAdapterTest extends AdapterTestCase
public static function setUpBeforeClass(): void
{
if (!\extension_loaded('pdo_sqlite')) {
throw new SkippedTestSuiteError('Extension pdo_sqlite required.');
self::markTestSkipped('Extension pdo_sqlite required.');
}

self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;
use Symfony\Component\Cache\Adapter\AbstractAdapter;

/**
Expand All @@ -22,13 +21,13 @@ class PredisAdapterSentinelTest extends AbstractRedisAdapterTestCase
public static function setUpBeforeClass(): void
{
if (!class_exists(\Predis\Client::class)) {
throw new SkippedTestSuiteError('The Predis\Client class is required.');
self::markTestSkipped('The Predis\Client class is required.');
}
if (!$hosts = getenv('REDIS_SENTINEL_HOSTS')) {
throw new SkippedTestSuiteError('REDIS_SENTINEL_HOSTS env var is not defined.');
self::markTestSkipped('REDIS_SENTINEL_HOSTS env var is not defined.');
}
if (!$service = getenv('REDIS_SENTINEL_SERVICE')) {
throw new SkippedTestSuiteError('REDIS_SENTINEL_SERVICE env var is not defined.');
self::markTestSkipped('REDIS_SENTINEL_SERVICE env var is not defined.');
}

self::$redis = AbstractAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', ['redis_sentinel' => $service, 'class' => \Predis\Client::class]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;
use Symfony\Component\Cache\Adapter\RedisAdapter;

/**
Expand All @@ -22,7 +21,7 @@ class PredisRedisClusterAdapterTest extends AbstractRedisAdapterTestCase
public static function setUpBeforeClass(): void
{
if (!$hosts = getenv('REDIS_CLUSTER_HOSTS')) {
throw new SkippedTestSuiteError('REDIS_CLUSTER_HOSTS env var is not defined.');
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
}

self::$redis = RedisAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', ['class' => \Predis\Client::class, 'redis_cluster' => true, 'prefix' => 'prefix_']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
Expand All @@ -24,13 +23,13 @@ class RedisAdapterSentinelTest extends AbstractRedisAdapterTestCase
public static function setUpBeforeClass(): void
{
if (!class_exists(\RedisSentinel::class)) {
throw new SkippedTestSuiteError('The RedisSentinel class is required.');
self::markTestSkipped('The RedisSentinel class is required.');
}
if (!$hosts = getenv('REDIS_SENTINEL_HOSTS')) {
throw new SkippedTestSuiteError('REDIS_SENTINEL_HOSTS env var is not defined.');
self::markTestSkipped('REDIS_SENTINEL_HOSTS env var is not defined.');
}
if (!$service = getenv('REDIS_SENTINEL_SERVICE')) {
throw new SkippedTestSuiteError('REDIS_SENTINEL_SERVICE env var is not defined.');
self::markTestSkipped('REDIS_SENTINEL_SERVICE env var is not defined.');
}

self::$redis = AbstractAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', ['redis_sentinel' => $service, 'prefix' => 'prefix_']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;

/**
* @group integration
*/
Expand All @@ -22,7 +20,7 @@ public static function setUpBeforeClass(): void
{
parent::setupBeforeClass();
if (!class_exists(\RedisArray::class)) {
throw new SkippedTestSuiteError('The RedisArray class is required.');
self::markTestSkipped('The RedisArray class is required.');
}
self::$redis = new \RedisArray([getenv('REDIS_HOST')], ['lazy_connect' => true]);
self::$redis->setOption(\Redis::OPT_PREFIX, 'prefix_');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;
Expand All @@ -26,10 +25,10 @@ class RedisClusterAdapterTest extends AbstractRedisAdapterTestCase
public static function setUpBeforeClass(): void
{
if (!class_exists(\RedisCluster::class)) {
throw new SkippedTestSuiteError('The RedisCluster class is required.');
self::markTestSkipped('The RedisCluster class is required.');
}
if (!$hosts = getenv('REDIS_CLUSTER_HOSTS')) {
throw new SkippedTestSuiteError('REDIS_CLUSTER_HOSTS env var is not defined.');
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
}

self::$redis = AbstractAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', ['lazy' => true, 'redis_cluster' => true]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;
use Relay\Relay;
use Relay\Sentinel;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
Expand All @@ -24,13 +23,13 @@ class RelayAdapterSentinelTest extends AbstractRedisAdapterTestCase
public static function setUpBeforeClass(): void
{
if (!class_exists(Sentinel::class)) {
throw new SkippedTestSuiteError('The Relay\Sentinel class is required.');
self::markTestSkipped('The Relay\Sentinel class is required.');
}
if (!$hosts = getenv('REDIS_SENTINEL_HOSTS')) {
throw new SkippedTestSuiteError('REDIS_SENTINEL_HOSTS env var is not defined.');
self::markTestSkipped('REDIS_SENTINEL_HOSTS env var is not defined.');
}
if (!$service = getenv('REDIS_SENTINEL_SERVICE')) {
throw new SkippedTestSuiteError('REDIS_SENTINEL_SERVICE env var is not defined.');
self::markTestSkipped('REDIS_SENTINEL_SERVICE env var is not defined.');
}

self::$redis = AbstractAdapter::createConnection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use PHPUnit\Framework\SkippedTestSuiteError;
use Relay\Relay;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;
Expand All @@ -30,7 +29,7 @@ public static function setUpBeforeClass(): void
try {
new Relay(...explode(':', getenv('REDIS_HOST')));
} catch (\Relay\Exception $e) {
throw new SkippedTestSuiteError(getenv('REDIS_HOST').': '.$e->getMessage());
self::markTestSkipped(getenv('REDIS_HOST').': '.$e->getMessage());
}
self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), ['lazy' => true, 'class' => Relay::class]);
self::assertInstanceOf(RelayProxy::class, self::$redis);
Expand Down
7 changes: 3 additions & 4 deletions src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Cache\Tests\Traits;

use PHPUnit\Framework\SkippedTestSuiteError;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Cache\Traits\RedisTrait;

Expand All @@ -20,7 +19,7 @@ class RedisTraitTest extends TestCase
public static function setUpBeforeClass(): void
{
if (!getenv('REDIS_CLUSTER_HOSTS')) {
throw new SkippedTestSuiteError('REDIS_CLUSTER_HOSTS env var is not defined.');
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
}
}

Expand All @@ -30,10 +29,10 @@ public static function setUpBeforeClass(): void
public function testCreateConnection(string $dsn, string $expectedClass)
{
if (!class_exists($expectedClass)) {
throw new SkippedTestSuiteError(sprintf('The "%s" class is required.', $expectedClass));
self::markTestSkipped(sprintf('The "%s" class is required.', $expectedClass));
}
if (!getenv('REDIS_CLUSTER_HOSTS')) {
throw new SkippedTestSuiteError('REDIS_CLUSTER_HOSTS env var is not defined.');
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
}

$mock = self::getObjectForTrait(RedisTrait::class);
Expand Down
9 changes: 4 additions & 5 deletions src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\HttpClient\Tests;

use PHPUnit\Framework\SkippedTestSuiteError;
use Symfony\Component\HttpClient\Exception\ClientException;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Component\HttpClient\Internal\ClientState;
Expand Down Expand Up @@ -318,7 +317,7 @@ private static function startVulcain(HttpClientInterface $client)
}

if ('\\' === \DIRECTORY_SEPARATOR) {
throw new SkippedTestSuiteError('Testing with the "vulcain" is not supported on Windows.');
self::markTestSkipped('Testing with the "vulcain" is not supported on Windows.');
}

$process = new Process(['vulcain'], null, [
Expand All @@ -335,14 +334,14 @@ private static function startVulcain(HttpClientInterface $client)

if (!$process->isRunning()) {
if ('\\' !== \DIRECTORY_SEPARATOR && 127 === $process->getExitCode()) {
throw new SkippedTestSuiteError('vulcain binary is missing');
self::markTestSkipped('vulcain binary is missing');
}

if ('\\' !== \DIRECTORY_SEPARATOR && 126 === $process->getExitCode()) {
throw new SkippedTestSuiteError('vulcain binary is not executable');
self::markTestSkipped('vulcain binary is not executable');
}

throw new SkippedTestSuiteError((new ProcessFailedException($process))->getMessage());
self::markTestSkipped((new ProcessFailedException($process))->getMessage());
}

self::$vulcainStarted = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\HttpFoundation\Tests;

use PHPUnit\Framework\SkippedTestSuiteError;
use PHPUnit\Framework\TestCase;

class ResponseFunctionalTest extends TestCase
Expand All @@ -26,7 +25,7 @@ public static function setUpBeforeClass(): void
2 => ['file', '/dev/null', 'w'],
];
if (!self::$server = @proc_open('exec '.\PHP_BINARY.' -S localhost:8054', $spec, $pipes, __DIR__.'/Fixtures/response-functional')) {
throw new SkippedTestSuiteError('PHP server unable to start.');
self::markTestSkipped('PHP server unable to start.');
}
sleep(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;

use PHPUnit\Framework\SkippedTestSuiteError;
use PHPUnit\Framework\TestCase;

class AbstractSessionHandlerTest extends TestCase
Expand All @@ -26,7 +25,7 @@ public static function setUpBeforeClass(): void
2 => ['file', '/dev/null', 'w'],
];
if (!self::$server = @proc_open('exec '.\PHP_BINARY.' -S localhost:8053', $spec, $pipes, __DIR__.'/Fixtures')) {
throw new SkippedTestSuiteError('PHP server unable to start.');
self::markTestSkipped('PHP server unable to start.');
}
sleep(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;

use PHPUnit\Framework\SkippedTestSuiteError;

/**
* @group integration
*/
Expand All @@ -21,11 +19,11 @@ class RedisClusterSessionHandlerTest extends AbstractRedisSessionHandlerTestCase
public static function setUpBeforeClass(): void
{
if (!class_exists(\RedisCluster::class)) {
throw new SkippedTestSuiteError('The RedisCluster class is required.');
self::markTestSkipped('The RedisCluster class is required.');
}

if (!$hosts = getenv('REDIS_CLUSTER_HOSTS')) {
throw new SkippedTestSuiteError('REDIS_CLUSTER_HOSTS env var is not defined.');
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

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 @@ -31,7 +30,7 @@ class MemcachedStoreTest extends AbstractStoreTestCase
public static function setUpBeforeClass(): void
{
if (version_compare(phpversion('memcached'), '3.1.6', '<')) {
throw new SkippedTestSuiteError('Extension memcached > 3.1.5 required.');
self::markTestSkipped('Extension memcached > 3.1.5 required.');
}

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

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

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy