From 97bcb5da50823747b3a44875b62b165c5cb29a55 Mon Sep 17 00:00:00 2001 From: Luis Pabon Date: Thu, 1 Aug 2019 11:16:35 +0100 Subject: [PATCH 1/3] Ensure signatures for setUp|tearDown|setUpAfterClass|tearDownAfterClass methods in tests are compatible with phpunit 8.2 --- .../Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php | 2 +- .../Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php | 2 +- .../Tests/Messenger/DoctrineTransactionMiddlewareTest.php | 2 +- src/Symfony/Bridge/PhpUnit/Tests/ClassExistsMockTest.php | 4 ++-- .../Tests/Command/CachePoolDeleteCommandTest.php | 2 +- .../FrameworkBundle/Tests/Command/XliffLintCommandTest.php | 4 ++-- .../Tests/Functional/CachePoolListCommandTest.php | 2 +- .../Tests/Functional/RouterDebugCommandTest.php | 2 +- .../Tests/Functional/TranslationDebugCommandTest.php | 2 +- .../Cache/Tests/Adapter/PredisTagAwareAdapterTest.php | 2 +- .../Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php | 2 +- .../Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php | 2 +- .../Cache/Tests/Adapter/RedisTagAwareAdapterTest.php | 2 +- .../Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php | 2 +- .../Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php | 2 +- .../Cache/Tests/DependencyInjection/CachePoolPassTest.php | 2 +- src/Symfony/Component/Cache/Tests/Psr16CacheTest.php | 2 +- .../Console/Tests/Helper/DumperNativeFallbackTest.php | 4 ++-- src/Symfony/Component/Console/Tests/Helper/DumperTest.php | 4 ++-- .../Console/Tests/Output/ConsoleSectionOutputTest.php | 4 ++-- src/Symfony/Component/Console/Tests/Question/QuestionTest.php | 2 +- .../Tests/ParameterBag/ContainerBagTest.php | 2 +- .../Component/EventDispatcher/Tests/EventDispatcherTest.php | 4 ++-- .../Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php | 4 ++-- .../Core/DataTransformer/StringToFloatTransformerTest.php | 4 ++-- src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php | 2 +- .../Session/Storage/Handler/MigratingSessionHandlerTest.php | 2 +- .../Storage/Handler/RedisClusterSessionHandlerTest.php | 2 +- .../Tests/EventListener/LocaleAwareListenerTest.php | 2 +- src/Symfony/Component/Lock/Tests/Store/PdoDbalStoreTest.php | 4 ++-- src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php | 4 ++-- .../Component/Messenger/Tests/Command/DebugCommandTest.php | 4 ++-- .../Tests/DataCollector/MessengerDataCollectorTest.php | 2 +- .../Tests/Transport/AmqpExt/AmqpExtIntegrationTest.php | 2 +- .../Tests/Transport/InMemoryTransportFactoryTest.php | 2 +- .../Messenger/Tests/Transport/InMemoryTransportTest.php | 2 +- .../Tests/Transport/RedisExt/RedisExtIntegrationTest.php | 2 +- .../Component/Mime/Tests/AbstractMimeTypeGuesserTest.php | 2 +- .../Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php | 4 ++-- .../Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php | 4 ++-- .../Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php | 2 +- .../Normalizer/ConstraintViolationListNormalizerTest.php | 2 +- .../Tests/Normalizer/DateTimeZoneNormalizerTest.php | 2 +- .../Translation/Tests/Command/XliffLintCommandTest.php | 4 ++-- .../VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php | 4 ++-- .../VarDumper/Tests/Command/Descriptor/HtmlDescriptorTest.php | 4 ++-- .../Workflow/Tests/Metadata/InMemoryMetadataStoreTest.php | 2 +- src/Symfony/Component/Yaml/Tests/ParserTest.php | 4 ++-- 48 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php index df5414e3cc..94cab6314e 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php @@ -27,7 +27,7 @@ class DoctrineCloseConnectionMiddlewareTest extends MiddlewareTestCase private $middleware; private $entityManagerName = 'default'; - protected function setUp() + protected function setUp(): void { $this->connection = $this->createMock(Connection::class); diff --git a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php index ae71d0d168..f3aa27f314 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php @@ -27,7 +27,7 @@ class DoctrinePingConnectionMiddlewareTest extends MiddlewareTestCase private $middleware; private $entityManagerName = 'default'; - protected function setUp() + protected function setUp(): void { $this->connection = $this->createMock(Connection::class); diff --git a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php index 04fb86140e..bb77786339 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php @@ -25,7 +25,7 @@ class DoctrineTransactionMiddlewareTest extends MiddlewareTestCase private $entityManager; private $middleware; - public function setUp() + public function setUp(): void { $this->connection = $this->createMock(Connection::class); diff --git a/src/Symfony/Bridge/PhpUnit/Tests/ClassExistsMockTest.php b/src/Symfony/Bridge/PhpUnit/Tests/ClassExistsMockTest.php index 002d313a6f..3e3d5771b1 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/ClassExistsMockTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/ClassExistsMockTest.php @@ -16,12 +16,12 @@ use Symfony\Bridge\PhpUnit\ClassExistsMock; class ClassExistsMockTest extends TestCase { - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { ClassExistsMock::register(__CLASS__); } - protected function setUp() + protected function setUp(): void { ClassExistsMock::withMockedClasses([ ExistingClass::class => false, diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php index e22d854207..143364eacd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php @@ -23,7 +23,7 @@ class CachePoolDeleteCommandTest extends TestCase { private $cachePool; - protected function setUp() + protected function setUp(): void { $this->cachePool = $this->getMockBuilder(CacheItemPoolInterface::class) ->getMock(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php index 1729351a7d..542272da55 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php @@ -131,13 +131,13 @@ EOF; return $application; } - protected function setUp() + protected function setUp(): void { @mkdir(sys_get_temp_dir().'/xliff-lint-test'); $this->files = []; } - protected function tearDown() + protected function tearDown(): void { foreach ($this->files as $file) { if (file_exists($file)) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php index e9b8ed5e34..a76234697e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Tester\CommandTester; */ class CachePoolListCommandTest extends AbstractWebTestCase { - protected function setUp() + protected function setUp(): void { static::bootKernel(['test_case' => 'CachePools', 'root_config' => 'config.yml']); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php index a13a4e9fc9..c7c7ac9ace 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php @@ -21,7 +21,7 @@ class RouterDebugCommandTest extends AbstractWebTestCase { private $application; - protected function setUp() + protected function setUp(): void { $kernel = static::createKernel(['test_case' => 'RouterDebug', 'root_config' => 'config.yml']); $this->application = new Application($kernel); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php index de4c293c09..8ce0ce0609 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php @@ -21,7 +21,7 @@ class TranslationDebugCommandTest extends AbstractWebTestCase { private $application; - protected function setUp() + protected function setUp(): void { $kernel = static::createKernel(['test_case' => 'TransDebug', 'root_config' => 'config.yml']); $this->application = new Application($kernel); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php index e321a1c9b8..e685d76083 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php @@ -18,7 +18,7 @@ class PredisTagAwareAdapterTest extends PredisAdapterTest { use TagAwareTestTrait; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php index a8a72e1de4..8c604c1ca6 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php @@ -18,7 +18,7 @@ class PredisTagAwareClusterAdapterTest extends PredisClusterAdapterTest { use TagAwareTestTrait; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php index 5b82a80ecb..e8d2ea654f 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php @@ -18,7 +18,7 @@ class PredisTagAwareRedisClusterAdapterTest extends PredisRedisClusterAdapterTes { use TagAwareTestTrait; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php index 95e5fe7e3a..ef14081857 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php @@ -19,7 +19,7 @@ class RedisTagAwareAdapterTest extends RedisAdapterTest { use TagAwareTestTrait; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php index 5855cc3adf..7c98020408 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php @@ -18,7 +18,7 @@ class RedisTagAwareArrayAdapterTest extends RedisArrayAdapterTest { use TagAwareTestTrait; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php index ef17c1d69e..7b7d680194 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php @@ -19,7 +19,7 @@ class RedisTagAwareClusterAdapterTest extends RedisClusterAdapterTest { use TagAwareTestTrait; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; diff --git a/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php b/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php index 4681b3dc81..7a175c17e9 100644 --- a/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php +++ b/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php @@ -24,7 +24,7 @@ class CachePoolPassTest extends TestCase { private $cachePoolPass; - protected function setUp() + protected function setUp(): void { $this->cachePoolPass = new CachePoolPass(); } diff --git a/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php b/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php index e56d99e441..7774e1ddd5 100644 --- a/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php @@ -21,7 +21,7 @@ use Symfony\Component\Cache\Psr16Cache; */ class Psr16CacheTest extends SimpleCacheTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/src/Symfony/Component/Console/Tests/Helper/DumperNativeFallbackTest.php b/src/Symfony/Component/Console/Tests/Helper/DumperNativeFallbackTest.php index b9fa2dc294..b0d13cc1b7 100644 --- a/src/Symfony/Component/Console/Tests/Helper/DumperNativeFallbackTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/DumperNativeFallbackTest.php @@ -19,7 +19,7 @@ use Symfony\Component\VarDumper\Dumper\CliDumper; class DumperNativeFallbackTest extends TestCase { - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { ClassExistsMock::register(Dumper::class); ClassExistsMock::withMockedClasses([ @@ -27,7 +27,7 @@ class DumperNativeFallbackTest extends TestCase ]); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { ClassExistsMock::withMockedClasses([]); } diff --git a/src/Symfony/Component/Console/Tests/Helper/DumperTest.php b/src/Symfony/Component/Console/Tests/Helper/DumperTest.php index 00c480a6a9..7974527d36 100644 --- a/src/Symfony/Component/Console/Tests/Helper/DumperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/DumperTest.php @@ -20,13 +20,13 @@ class DumperTest extends TestCase { use VarDumperTestTrait; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { putenv('DUMP_LIGHT_ARRAY=1'); putenv('DUMP_COMMA_SEPARATOR=1'); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { putenv('DUMP_LIGHT_ARRAY'); putenv('DUMP_COMMA_SEPARATOR'); diff --git a/src/Symfony/Component/Console/Tests/Output/ConsoleSectionOutputTest.php b/src/Symfony/Component/Console/Tests/Output/ConsoleSectionOutputTest.php index 4c292c2c69..e8d9a8b492 100644 --- a/src/Symfony/Component/Console/Tests/Output/ConsoleSectionOutputTest.php +++ b/src/Symfony/Component/Console/Tests/Output/ConsoleSectionOutputTest.php @@ -24,12 +24,12 @@ class ConsoleSectionOutputTest extends TestCase { private $stream; - protected function setUp() + protected function setUp(): void { $this->stream = fopen('php://memory', 'r+b', false); } - protected function tearDown() + protected function tearDown(): void { $this->stream = null; } diff --git a/src/Symfony/Component/Console/Tests/Question/QuestionTest.php b/src/Symfony/Component/Console/Tests/Question/QuestionTest.php index 13c8e362e1..59b714291a 100644 --- a/src/Symfony/Component/Console/Tests/Question/QuestionTest.php +++ b/src/Symfony/Component/Console/Tests/Question/QuestionTest.php @@ -19,7 +19,7 @@ class QuestionTest extends TestCase { private $question; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->question = new Question('Test question'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ContainerBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ContainerBagTest.php index 24ed685e49..c807b2c989 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ContainerBagTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ContainerBagTest.php @@ -26,7 +26,7 @@ class ContainerBagTest extends TestCase /** @var ContainerBag */ private $containerBag; - protected function setUp() + protected function setUp(): void { $this->parameterBag = new ParameterBag(['foo' => 'value']); $this->containerBag = new ContainerBag(new Container($this->parameterBag)); diff --git a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php index 658a941239..9b9253b479 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php @@ -32,13 +32,13 @@ class EventDispatcherTest extends TestCase private $listener; - protected function setUp() + protected function setUp(): void { $this->dispatcher = $this->createEventDispatcher(); $this->listener = new TestEventListener(); } - protected function tearDown() + protected function tearDown(): void { $this->dispatcher = null; $this->listener = null; diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php index 7571517283..a5fc262dcd 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php @@ -47,7 +47,7 @@ class IntlCallbackChoiceLoaderTest extends TestCase */ private static $lazyChoiceList; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { self::$loader = new IntlCallbackChoiceLoader(function () { return self::$choices; @@ -98,7 +98,7 @@ class IntlCallbackChoiceLoaderTest extends TestCase ); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { self::$loader = null; self::$value = null; diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/StringToFloatTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/StringToFloatTransformerTest.php index 5726a217da..2eae3121b6 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/StringToFloatTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/StringToFloatTransformerTest.php @@ -18,12 +18,12 @@ class StringToFloatTransformerTest extends TestCase { private $transformer; - protected function setUp() + protected function setUp(): void { $this->transformer = new StringToFloatTransformer(); } - protected function tearDown() + protected function tearDown(): void { $this->transformer = null; } diff --git a/src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php b/src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php index 87b2a7ce0b..42e627b590 100644 --- a/src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php +++ b/src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php @@ -23,7 +23,7 @@ class Psr18ClientTest extends TestCase { private static $server; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { TestHttpServer::start(); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php index 6dc5b0cb5c..01615e6b1f 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php @@ -20,7 +20,7 @@ class MigratingSessionHandlerTest extends TestCase private $currentHandler; private $writeOnlyHandler; - protected function setUp() + protected function setUp(): void { $this->currentHandler = $this->createMock(\SessionHandlerInterface::class); $this->writeOnlyHandler = $this->createMock(\SessionHandlerInterface::class); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/RedisClusterSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/RedisClusterSessionHandlerTest.php index 7d85a59ee7..c1ba70dcb0 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/RedisClusterSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/RedisClusterSessionHandlerTest.php @@ -13,7 +13,7 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; class RedisClusterSessionHandlerTest extends AbstractRedisSessionHandlerTestCase { - public static function setupBeforeClass() + public static function setUpBeforeClass(): void { if (!class_exists('RedisCluster')) { self::markTestSkipped('The RedisCluster class is required.'); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php index 489b02151c..ef3b7d1b42 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php @@ -26,7 +26,7 @@ class LocaleAwareListenerTest extends TestCase private $localeAwareService; private $requestStack; - protected function setUp() + protected function setUp(): void { $this->localeAwareService = $this->getMockBuilder(LocaleAwareInterface::class)->getMock(); $this->requestStack = new RequestStack(); diff --git a/src/Symfony/Component/Lock/Tests/Store/PdoDbalStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PdoDbalStoreTest.php index 0dd32c0847..2a8ec082a1 100644 --- a/src/Symfony/Component/Lock/Tests/Store/PdoDbalStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/PdoDbalStoreTest.php @@ -25,7 +25,7 @@ class PdoDbalStoreTest extends AbstractStoreTest protected static $dbFile; - public static function setupBeforeClass() + public static function setUpBeforeClass(): void { self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_lock'); @@ -33,7 +33,7 @@ class PdoDbalStoreTest extends AbstractStoreTest $store->createTable(); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { @unlink(self::$dbFile); } diff --git a/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php index 45e3544e2b..40797ae7cb 100644 --- a/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php @@ -24,7 +24,7 @@ class PdoStoreTest extends AbstractStoreTest protected static $dbFile; - public static function setupBeforeClass() + public static function setUpBeforeClass(): void { self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_lock'); @@ -32,7 +32,7 @@ class PdoStoreTest extends AbstractStoreTest $store->createTable(); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { @unlink(self::$dbFile); } diff --git a/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php index ed867aa975..e78b88d0fc 100644 --- a/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php +++ b/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php @@ -26,12 +26,12 @@ use Symfony\Component\Messenger\Tests\Fixtures\MultipleBusesMessageHandler; */ class DebugCommandTest extends TestCase { - protected function setUp() + protected function setUp(): void { putenv('COLUMNS='.(119 + \strlen(PHP_EOL))); } - protected function tearDown() + protected function tearDown(): void { putenv('COLUMNS='); } diff --git a/src/Symfony/Component/Messenger/Tests/DataCollector/MessengerDataCollectorTest.php b/src/Symfony/Component/Messenger/Tests/DataCollector/MessengerDataCollectorTest.php index abe1b3453f..cebcd78348 100644 --- a/src/Symfony/Component/Messenger/Tests/DataCollector/MessengerDataCollectorTest.php +++ b/src/Symfony/Component/Messenger/Tests/DataCollector/MessengerDataCollectorTest.php @@ -28,7 +28,7 @@ class MessengerDataCollectorTest extends TestCase /** @var CliDumper */ private $dumper; - protected function setUp() + protected function setUp(): void { $this->dumper = new CliDumper(); $this->dumper->setColors(false); diff --git a/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpExtIntegrationTest.php b/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpExtIntegrationTest.php index 956e09dc31..d62e3014da 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpExtIntegrationTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpExtIntegrationTest.php @@ -36,7 +36,7 @@ use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; */ class AmqpExtIntegrationTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportFactoryTest.php b/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportFactoryTest.php index fd6bebc3b6..94c2b5580e 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportFactoryTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportFactoryTest.php @@ -28,7 +28,7 @@ class InMemoryTransportFactoryTest extends TestCase */ private $factory; - protected function setUp() + protected function setUp(): void { $this->factory = new InMemoryTransportFactory(); } diff --git a/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportTest.php b/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportTest.php index 5d9c8b7008..2d37e624d3 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportTest.php @@ -25,7 +25,7 @@ class InMemoryTransportTest extends TestCase */ private $transport; - protected function setUp() + protected function setUp(): void { $this->transport = new InMemoryTransport(); } diff --git a/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/RedisExtIntegrationTest.php b/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/RedisExtIntegrationTest.php index 5342250e84..66ada676ed 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/RedisExtIntegrationTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/RedisExt/RedisExtIntegrationTest.php @@ -23,7 +23,7 @@ class RedisExtIntegrationTest extends TestCase private $redis; private $connection; - protected function setUp() + protected function setUp(): void { if (!getenv('MESSENGER_REDIS_DSN')) { $this->markTestSkipped('The "MESSENGER_REDIS_DSN" environment variable is required.'); diff --git a/src/Symfony/Component/Mime/Tests/AbstractMimeTypeGuesserTest.php b/src/Symfony/Component/Mime/Tests/AbstractMimeTypeGuesserTest.php index f9f5ec5703..3ac9382f84 100644 --- a/src/Symfony/Component/Mime/Tests/AbstractMimeTypeGuesserTest.php +++ b/src/Symfony/Component/Mime/Tests/AbstractMimeTypeGuesserTest.php @@ -16,7 +16,7 @@ use Symfony\Component\Mime\MimeTypeGuesserInterface; abstract class AbstractMimeTypeGuesserTest extends TestCase { - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { $path = __DIR__.'/Fixtures/mimetypes/to_delete'; if (file_exists($path)) { diff --git a/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php b/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php index 127b8b977c..e6b076302c 100644 --- a/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php @@ -41,7 +41,7 @@ class CompiledUrlGeneratorDumperTest extends TestCase */ private $largeTestTmpFilepath; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -53,7 +53,7 @@ class CompiledUrlGeneratorDumperTest extends TestCase @unlink($this->largeTestTmpFilepath); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php index ad9c8376f7..91f60de936 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php @@ -26,14 +26,14 @@ class CompiledUrlMatcherDumperTest extends TestCase */ private $dumpPath; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->dumpPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_matcher.'.uniqid('CompiledUrlMatcher').'.php'; } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php index 84c8b4849e..9a0a3f0d0e 100644 --- a/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Encoder/SodiumPasswordEncoderTest.php @@ -16,7 +16,7 @@ use Symfony\Component\Security\Core\Encoder\SodiumPasswordEncoder; class SodiumPasswordEncoderTest extends TestCase { - protected function setUp() + protected function setUp(): void { if (!SodiumPasswordEncoder::isSupported()) { $this->markTestSkipped('Libsodium is not available.'); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ConstraintViolationListNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ConstraintViolationListNormalizerTest.php index 24fc7cd2be..de5e94eed1 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ConstraintViolationListNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ConstraintViolationListNormalizerTest.php @@ -25,7 +25,7 @@ class ConstraintViolationListNormalizerTest extends TestCase { private $normalizer; - protected function setUp() + protected function setUp(): void { $this->normalizer = new ConstraintViolationListNormalizer(); } diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php index 6f2486d3db..c2a851ef78 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php @@ -24,7 +24,7 @@ class DateTimeZoneNormalizerTest extends TestCase */ private $normalizer; - protected function setUp() + protected function setUp(): void { $this->normalizer = new DateTimeZoneNormalizer(); } diff --git a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php index df2e2f0951..abda2135fc 100644 --- a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php +++ b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php @@ -188,13 +188,13 @@ XLIFF; return new CommandTester($command); } - protected function setUp() + protected function setUp(): void { $this->files = []; @mkdir(sys_get_temp_dir().'/translation-xliff-lint-test'); } - protected function tearDown() + protected function tearDown(): void { foreach ($this->files as $file) { if (file_exists($file)) { diff --git a/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php b/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php index fef5dcd127..ccd8c50760 100644 --- a/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php @@ -23,7 +23,7 @@ class CliDescriptorTest extends TestCase private static $timezone; private static $prevTerminalEmulator; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { self::$timezone = date_default_timezone_get(); date_default_timezone_set('UTC'); @@ -32,7 +32,7 @@ class CliDescriptorTest extends TestCase putenv('TERMINAL_EMULATOR'); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { date_default_timezone_set(self::$timezone); putenv('TERMINAL_EMULATOR'.(self::$prevTerminalEmulator ? '='.self::$prevTerminalEmulator : '')); diff --git a/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/HtmlDescriptorTest.php b/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/HtmlDescriptorTest.php index f1febf7cec..426e99d360 100644 --- a/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/HtmlDescriptorTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/HtmlDescriptorTest.php @@ -21,13 +21,13 @@ class HtmlDescriptorTest extends TestCase { private static $timezone; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { self::$timezone = date_default_timezone_get(); date_default_timezone_set('UTC'); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { date_default_timezone_set(self::$timezone); } diff --git a/src/Symfony/Component/Workflow/Tests/Metadata/InMemoryMetadataStoreTest.php b/src/Symfony/Component/Workflow/Tests/Metadata/InMemoryMetadataStoreTest.php index 0ce8d9d5d8..16d2d6f20c 100644 --- a/src/Symfony/Component/Workflow/Tests/Metadata/InMemoryMetadataStoreTest.php +++ b/src/Symfony/Component/Workflow/Tests/Metadata/InMemoryMetadataStoreTest.php @@ -14,7 +14,7 @@ class InMemoryMetadataStoreTest extends TestCase private $store; private $transition; - protected function setUp() + protected function setUp(): void { $workflowMetadata = [ 'title' => 'workflow title', diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 3a9cb1290f..d84144aa63 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -25,12 +25,12 @@ class ParserTest extends TestCase /** @var Parser */ protected $parser; - protected function setUp() + protected function setUp(): void { $this->parser = new Parser(); } - protected function tearDown() + protected function tearDown(): void { $this->parser = null; From 51ba6651aaeb3b778f6e88e064e6276a1b3ce2d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Thu, 1 Aug 2019 12:54:54 +0200 Subject: [PATCH 2/3] Fix assertInternalType deprecation in phpunit 9 --- .../Component/HttpClient/Tests/HttpClientTestCase.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php b/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php index 0f5b167757..40a8f80278 100644 --- a/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php +++ b/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php @@ -11,10 +11,13 @@ namespace Symfony\Component\HttpClient\Tests; +use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait; use Symfony\Contracts\HttpClient\Test\HttpClientTestCase as BaseHttpClientTestCase; abstract class HttpClientTestCase extends BaseHttpClientTestCase { + use ForwardCompatTestTrait; + public function testToStream() { $client = $this->getHttpClient(__FUNCTION__); @@ -28,7 +31,7 @@ abstract class HttpClientTestCase extends BaseHttpClientTestCase $this->assertFalse(feof($stream)); $this->assertTrue(rewind($stream)); - $this->assertInternalType('array', json_decode(fread($stream, 1024), true)); + $this->assertIsArray(json_decode(fread($stream, 1024), true)); $this->assertSame('', fread($stream, 1)); $this->assertTrue(feof($stream)); } From aa587895422782f5156d7fa28c3278f04530a6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Thu, 1 Aug 2019 12:47:31 +0200 Subject: [PATCH 3/3] Fix assertInternalType deprecation in phpunit 9 --- src/Symfony/Component/Intl/Tests/CurrenciesTest.php | 5 ++++- src/Symfony/Component/Workflow/Tests/RegistryTest.php | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Intl/Tests/CurrenciesTest.php b/src/Symfony/Component/Intl/Tests/CurrenciesTest.php index 102cf3f4c7..612e017b0a 100644 --- a/src/Symfony/Component/Intl/Tests/CurrenciesTest.php +++ b/src/Symfony/Component/Intl/Tests/CurrenciesTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Intl\Tests; +use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait; use Symfony\Component\Intl\Currencies; /** @@ -18,6 +19,8 @@ use Symfony\Component\Intl\Currencies; */ class CurrenciesTest extends ResourceBundleTestCase { + use ForwardCompatTestTrait; + // The below arrays document the state of the ICU data bundled with this package. private static $currencies = [ @@ -693,7 +696,7 @@ class CurrenciesTest extends ResourceBundleTestCase */ public function testGetRoundingIncrement($currency) { - $this->assertInternalType('numeric', Currencies::getRoundingIncrement($currency)); + $this->assertIsNumeric(Currencies::getRoundingIncrement($currency)); } public function provideCurrenciesWithNumericEquivalent() diff --git a/src/Symfony/Component/Workflow/Tests/RegistryTest.php b/src/Symfony/Component/Workflow/Tests/RegistryTest.php index 21c532ee7d..1fd15d6c3c 100644 --- a/src/Symfony/Component/Workflow/Tests/RegistryTest.php +++ b/src/Symfony/Component/Workflow/Tests/RegistryTest.php @@ -87,7 +87,7 @@ class RegistryTest extends TestCase public function testAllWithOneMatchWithSuccess() { $workflows = $this->registry->all(new Subject1()); - $this->assertInternalType('array', $workflows); + $this->assertIsArray($workflows); $this->assertCount(1, $workflows); $this->assertInstanceOf(Workflow::class, $workflows[0]); $this->assertSame('workflow1', $workflows[0]->getName()); @@ -96,7 +96,7 @@ class RegistryTest extends TestCase public function testAllWithMultipleMatchWithSuccess() { $workflows = $this->registry->all(new Subject2()); - $this->assertInternalType('array', $workflows); + $this->assertIsArray($workflows); $this->assertCount(2, $workflows); $this->assertInstanceOf(Workflow::class, $workflows[0]); $this->assertInstanceOf(Workflow::class, $workflows[1]); @@ -107,7 +107,7 @@ class RegistryTest extends TestCase public function testAllWithNoMatch() { $workflows = $this->registry->all(new \stdClass()); - $this->assertInternalType('array', $workflows); + $this->assertIsArray($workflows); $this->assertCount(0, $workflows); }