[4.3] Cleanup tests

This commit is contained in:
Nicolas Grekas 2019-09-02 16:45:56 +02:00
parent d423b0f473
commit d05e49797c
4 changed files with 19 additions and 9 deletions

View File

@ -23,8 +23,6 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
* to make real HTTP requests.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final
*/
class HttpBrowser extends AbstractBrowser
{
@ -32,7 +30,7 @@ class HttpBrowser extends AbstractBrowser
public function __construct(HttpClientInterface $client = null, History $history = null, CookieJar $cookieJar = null)
{
if (!class_exists(HttpClient::class)) {
if (!$client && !class_exists(HttpClient::class)) {
throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
}

View File

@ -35,7 +35,7 @@ class KernelForTest extends Kernel
return $this->booted;
}
public function getProjectDir()
public function getProjectDir(): string
{
return __DIR__;
}

View File

@ -654,7 +654,7 @@ EOF;
*
* @return Kernel
*/
protected function getKernel(array $methods = [], array $bundles = [], $debug = false)
protected function getKernel(array $methods = [], array $bundles = [], bool $debug = false): Kernel
{
$methods[] = 'registerBundles';
@ -668,9 +668,6 @@ EOF;
->method('registerBundles')
->willReturn($bundles)
;
$p = new \ReflectionProperty($kernel, 'rootDir');
$p->setAccessible(true);
$p->setValue($kernel, __DIR__.'/Fixtures');
return $kernel;
}
@ -689,7 +686,7 @@ class TestKernel implements HttpKernelInterface
{
}
public function getProjectDir()
public function getProjectDir(): string
{
return __DIR__.'/Fixtures';
}

View File

@ -20,6 +20,21 @@ use Symfony\Component\Messenger\Transport\RedisExt\Connection;
*/
class ConnectionTest extends TestCase
{
public static function setUpBeforeClass()
{
$redis = Connection::fromDsn('redis://localhost/queue');
try {
$redis->get();
} catch (TransportException $e) {
if (0 === strpos($e->getMessage(), 'ERR unknown command \'X')) {
self::markTestSkipped('Redis server >= 5 is required');
}
throw $e;
}
}
public function testFromInvalidDsn()
{
$this->expectException(\InvalidArgumentException::class);