Skip to content

Commit

Permalink
Merge branch '4.3' into 4.4
Browse files Browse the repository at this point in the history
* 4.3:
  Fix assertInternalType deprecation in phpunit 9
  Ensure signatures for setUp|tearDown|setUpAfterClass|tearDownAfterClass methods in tests are compatible with phpunit 8.2
  • Loading branch information
nicolas-grekas committed Aug 1, 2019
2 parents 0de86a2 + 1938a54 commit 122a7cf
Show file tree
Hide file tree
Showing 53 changed files with 77 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/PhpUnit/Tests/ClassExistsMockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CachePoolDeleteCommandTest extends TestCase
{
private $cachePool;

protected function setUp()
protected function setUp(): void
{
$this->cachePool = $this->getMockBuilder(CacheItemPoolInterface::class)
->getMock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ private function getKernelAwareApplicationMock()
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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
class CachePoolListCommandTest extends AbstractWebTestCase
{
protected function setUp()
protected function setUp(): void
{
static::bootKernel(['test_case' => 'CachePools', 'root_config' => 'config.yml']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CachePoolPassTest extends TestCase
{
private $cachePoolPass;

protected function setUp()
protected function setUp(): void
{
$this->cachePoolPass = new CachePoolPass();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Tests/Psr16CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
class Psr16CacheTest extends SimpleCacheTest
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

class DumperNativeFallbackTest extends TestCase
{
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
ClassExistsMock::register(Dumper::class);
ClassExistsMock::withMockedClasses([
CliDumper::class => false,
]);
}

public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
ClassExistsMock::withMockedClasses([]);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/Tests/Helper/DumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class DebugClassLoaderTest extends TestCase

private $loader;

protected function setUp()
protected function setUp(): void
{
$this->errorReporting = error_reporting(E_ALL);
$this->loader = new ClassLoader();
spl_autoload_register([$this->loader, 'loadClass'], true, true);
DebugClassLoader::enable();
}

protected function tearDown()
protected function tearDown(): void
{
DebugClassLoader::disable();
spl_autoload_unregister([$this->loader, 'loadClass']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -98,7 +98,7 @@ public function testLoadValuesForChoicesLoadsChoiceListOnFirstCall()
);
}

public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
self::$loader = null;
self::$value = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Psr18ClientTest extends TestCase
{
private static $server;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
TestHttpServer::start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ abstract class AbstractRedisSessionHandlerTestCase extends TestCase
*/
abstract protected function createRedisClient(string $host);

protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand All @@ -54,7 +54,7 @@ protected function setUp()
);
}

protected function tearDown()
protected function tearDown(): void
{
$this->redisClient = null;
$this->storage = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class RedisClusterSessionHandlerTest extends AbstractRedisSessionHandlerTestCase
{
public static function setupBeforeClass()
public static function setUpBeforeClass(): void
{
if (!class_exists('RedisCluster')) {
self::markTestSkipped('The RedisCluster class is required.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 4 additions & 1 deletion src/Symfony/Component/Intl/Tests/CurrenciesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@

namespace Symfony\Component\Intl\Tests;

use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Intl\Currencies;

/**
* @group intl-data
*/
class CurrenciesTest extends ResourceBundleTestCase
{
use ForwardCompatTestTrait;

// The below arrays document the state of the ICU data bundled with this package.

private static $currencies = [
Expand Down Expand Up @@ -693,7 +696,7 @@ public function testGetFractionDigits($currency)
*/
public function testGetRoundingIncrement($currency)
{
$this->assertInternalType('numeric', Currencies::getRoundingIncrement($currency));
$this->assertIsNumeric(Currencies::getRoundingIncrement($currency));
}

public function provideCurrenciesWithNumericEquivalent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ abstract class ResourceBundleTestCase extends TestCase

private static $rootLocales;

protected function setUp()
protected function setUp(): void
{
Locale::setDefault('en');
Locale::setDefaultFallback('en');
Expand Down

0 comments on commit 122a7cf

Please sign in to comment.