Skip to content

Commit

Permalink
minor #33042 Disable typehint patch on PHPUnit (jderusse)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.3 branch.

Discussion
----------

Disable typehint patch on PHPUnit

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32844
| License       | MIT
| Doc PR        | NA

This PR removes the `SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT` patch and adds a `: void` typehint on `setup` and `tearDown` methods in order to be compatible with PHPUnit 8

Commits
-------

a5af6c4 Disable phpunit typehint patch on 4.3 branch
  • Loading branch information
nicolas-grekas committed Aug 8, 2019
2 parents 0abd64b + a5af6c4 commit 3ae9910
Show file tree
Hide file tree
Showing 346 changed files with 498 additions and 499 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -19,7 +19,6 @@ env:
global:
- MIN_PHP=7.1.3
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php
- SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1
- MESSENGER_AMQP_DSN=amqp://localhost/%2f/messages
- MESSENGER_REDIS_DSN=redis://127.0.0.1:7001/messages

Expand Down
Expand Up @@ -20,7 +20,7 @@ class ContainerAwareEventManagerTest extends TestCase
private $container;
private $evm;

protected function setUp()
protected function setUp(): void
{
$this->container = new Container();
$this->evm = new ContainerAwareEventManager($this->container);
Expand Down
Expand Up @@ -26,7 +26,7 @@ class DoctrineExtensionTest extends TestCase
*/
private $extension;

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

Expand Down
Expand Up @@ -73,7 +73,7 @@ class DoctrineChoiceLoaderTest extends TestCase
*/
private $obj3;

protected function setUp()
protected function setUp(): void
{
$this->factory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
$this->om = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock();
Expand Down
Expand Up @@ -25,7 +25,7 @@ class CollectionToArrayTransformerTest extends TestCase
*/
private $transformer;

protected function setUp()
protected function setUp(): void
{
$this->transformer = new CollectionToArrayTransformer();
}
Expand Down
Expand Up @@ -28,7 +28,7 @@ class MergeDoctrineCollectionListenerTest extends TestCase
private $factory;
private $form;

protected function setUp()
protected function setUp(): void
{
$this->collection = new ArrayCollection(['test']);
$this->dispatcher = new EventDispatcher();
Expand All @@ -37,7 +37,7 @@ protected function setUp()
->getForm();
}

protected function tearDown()
protected function tearDown(): void
{
$this->collection = null;
$this->dispatcher = null;
Expand Down
Expand Up @@ -50,7 +50,7 @@ protected function getExtensions()
];
}

protected function setUp()
protected function setUp(): void
{
$this->em = DoctrineTestHelper::createTestEntityManager();

Expand Down
Expand Up @@ -60,7 +60,7 @@ class EntityTypeTest extends BaseTypeTest

protected static $supportedFeatureSetVersion = 304;

protected function setUp()
protected function setUp(): void
{
$this->em = DoctrineTestHelper::createTestEntityManager();
$this->emRegistry = $this->createRegistryMock('default', $this->em);
Expand Down Expand Up @@ -90,7 +90,7 @@ protected function setUp()
}
}

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

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php
Expand Up @@ -17,7 +17,7 @@

class ManagerRegistryTest extends TestCase
{
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
if (!class_exists('PHPUnit_Framework_TestCase')) {
self::markTestSkipped('proxy-manager-bridge is not yet compatible with namespaced phpunit versions.');
Expand Down
Expand Up @@ -58,7 +58,7 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase

protected $repositoryFactory;

protected function setUp()
protected function setUp(): void
{
$this->repositoryFactory = new TestRepositoryFactory();

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php
Expand Up @@ -21,12 +21,12 @@
*/
class ClockMockTest extends TestCase
{
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
ClockMock::register(__CLASS__);
}

protected function setUp()
protected function setUp(): void
{
ClockMock::withClockMock(1234567890.125);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php
Expand Up @@ -16,7 +16,7 @@

class DnsMockTest extends TestCase
{
protected function tearDown()
protected function tearDown(): void
{
DnsMock::withMockedHosts(array());
}
Expand Down
Expand Up @@ -30,7 +30,7 @@ class RuntimeInstantiatorTest extends TestCase
/**
* {@inheritdoc}
*/
protected function setUp()
protected function setUp(): void
{
$this->instantiator = new RuntimeInstantiator();
}
Expand Down
Expand Up @@ -32,7 +32,7 @@ class ProxyDumperTest extends TestCase
/**
* {@inheritdoc}
*/
protected function setUp()
protected function setUp(): void
{
$this->dumper = new ProxyDumper();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
Expand Up @@ -15,7 +15,7 @@ class AppVariableTest extends TestCase
*/
protected $appVariable;

protected function setUp()
protected function setUp(): void
{
$this->appVariable = new AppVariable();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
Expand Up @@ -93,12 +93,12 @@ private function createFile($content)
return $filename;
}

protected function setUp()
protected function setUp(): void
{
$this->files = [];
}

protected function tearDown()
protected function tearDown(): void
{
foreach ($this->files as $file) {
if (file_exists($file)) {
Expand Down
Expand Up @@ -33,7 +33,7 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori
*/
private $renderer;

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

Expand Down
Expand Up @@ -29,7 +29,7 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
*/
private $renderer;

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

Expand Down
Expand Up @@ -35,7 +35,7 @@ class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4Hori

private $renderer;

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

Expand Down
Expand Up @@ -33,7 +33,7 @@ class FormExtensionBootstrap4LayoutTest extends AbstractBootstrap4LayoutTest
*/
private $renderer;

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

Expand Down
Expand Up @@ -33,7 +33,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest

protected static $supportedFeatureSetVersion = 403;

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

Expand Down
Expand Up @@ -32,7 +32,7 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest

protected static $supportedFeatureSetVersion = 403;

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

Expand Down
Expand Up @@ -32,7 +32,7 @@ class WebLinkExtensionTest extends TestCase
*/
private $extension;

protected function setUp()
protected function setUp(): void
{
$this->request = new Request();

Expand Down
Expand Up @@ -28,7 +28,7 @@ class WorkflowExtensionTest extends TestCase
private $extension;
private $t1;

protected function setUp()
protected function setUp(): void
{
if (!class_exists(Workflow::class)) {
$this->markTestSkipped('The Workflow component is needed to run tests for this extension.');
Expand Down
Expand Up @@ -17,15 +17,15 @@ class AnnotationsCacheWarmerTest extends TestCase
{
private $cacheDir;

protected function setUp()
protected function setUp(): void
{
$this->cacheDir = sys_get_temp_dir().'/'.uniqid();
$fs = new Filesystem();
$fs->mkdir($this->cacheDir);
parent::setUp();
}

protected function tearDown()
protected function tearDown(): void
{
$fs = new Filesystem();
$fs->remove($this->cacheDir);
Expand Down
Expand Up @@ -38,7 +38,7 @@ class TemplatePathsCacheWarmerTest extends TestCase

private $tmpDir;

protected function setUp()
protected function setUp(): void
{
$this->templateFinder = $this
->getMockBuilder(TemplateFinderInterface::class)
Expand All @@ -59,7 +59,7 @@ protected function setUp()
$this->filesystem->mkdir($this->tmpDir);
}

protected function tearDown()
protected function tearDown(): void
{
$this->filesystem->remove($this->tmpDir);
}
Expand Down
Expand Up @@ -28,14 +28,14 @@ class CacheClearCommandTest extends TestCase
/** @var Filesystem */
private $fs;

protected function setUp()
protected function setUp(): void
{
$this->fs = new Filesystem();
$this->kernel = new TestAppKernel('test', true);
$this->fs->mkdir($this->kernel->getProjectDir());
}

protected function tearDown()
protected function tearDown(): void
{
$this->fs->remove($this->kernel->getProjectDir());
}
Expand Down
Expand Up @@ -127,15 +127,15 @@ public function testDebugInvalidDirectory()
$tester->execute(['locale' => 'en', 'bundle' => 'dir']);
}

protected function setUp()
protected function setUp(): void
{
$this->fs = new Filesystem();
$this->translationDir = sys_get_temp_dir().'/'.uniqid('sf_translation', true);
$this->fs->mkdir($this->translationDir.'/translations');
$this->fs->mkdir($this->translationDir.'/templates');
}

protected function tearDown()
protected function tearDown(): void
{
$this->fs->remove($this->translationDir);
}
Expand Down
Expand Up @@ -105,15 +105,15 @@ public function testWriteMessagesForSpecificDomain()
$this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay());
}

protected function setUp()
protected function setUp(): void
{
$this->fs = new Filesystem();
$this->translationDir = sys_get_temp_dir().'/'.uniqid('sf_translation', true);
$this->fs->mkdir($this->translationDir.'/translations');
$this->fs->mkdir($this->translationDir.'/templates');
}

protected function tearDown()
protected function tearDown(): void
{
$this->fs->remove($this->translationDir);
}
Expand Down
Expand Up @@ -181,13 +181,13 @@ private function getKernelAwareApplicationMock()
return $application;
}

protected function setUp()
protected function setUp(): void
{
@mkdir(sys_get_temp_dir().'/yml-lint-test');
$this->files = [];
}

protected function tearDown()
protected function tearDown(): void
{
foreach ($this->files as $file) {
if (file_exists($file)) {
Expand Down
Expand Up @@ -15,12 +15,12 @@

class TextDescriptorTest extends AbstractDescriptorTest
{
protected function setUp()
protected function setUp(): void
{
putenv('COLUMNS=121');
}

protected function tearDown()
protected function tearDown(): void
{
putenv('COLUMNS');
}
Expand Down
Expand Up @@ -23,15 +23,15 @@ class ControllerNameParserTest extends TestCase
{
protected $loader;

protected function setUp()
protected function setUp(): void
{
$this->loader = new ClassLoader();
$this->loader->add('TestBundle', __DIR__.'/../Fixtures');
$this->loader->add('TestApplication', __DIR__.'/../Fixtures');
$this->loader->register();
}

protected function tearDown()
protected function tearDown(): void
{
$this->loader->unregister();
$this->loader = null;
Expand Down
Expand Up @@ -26,7 +26,7 @@ class CachePoolPassTest extends TestCase
{
private $cachePoolPass;

protected function setUp()
protected function setUp(): void
{
$this->cachePoolPass = new CachePoolPass();
}
Expand Down

0 comments on commit 3ae9910

Please sign in to comment.