minor #33048 Remove ForwardCompatTestTrait (jderusse)
This PR was merged into the 5.0-dev branch.
Discussion
----------
Remove ForwardCompatTestTrait
| Q | A
| ------------- | ---
| Branch? | 5.0
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | NA
| License | MIT
| Doc PR | NA
Removes ForwardCompatTestTrait not needed anymore, and use the PHPUnit 8 signature on methods `setUp` and `tearDown`
Commits
-------
242786cf98
Remove ForwardCompatTestTrait
This commit is contained in:
commit
3483e62afe
@ -1,78 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Symfony package.
|
|
||||||
*
|
|
||||||
* (c) Fabien Potencier <fabien@symfony.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Test;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods
|
|
||||||
|
|
||||||
if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
trait ForwardCompatTestTrait
|
|
||||||
{
|
|
||||||
private function doSetUp(): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private function doTearDown(): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
$this->doSetUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
$this->doTearDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
trait ForwardCompatTestTrait
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function doSetUp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function doTearDown()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
$this->doSetUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
$this->doTearDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,8 +23,6 @@ use Symfony\Contracts\Service\ResetInterface;
|
|||||||
*/
|
*/
|
||||||
abstract class KernelTestCase extends TestCase
|
abstract class KernelTestCase extends TestCase
|
||||||
{
|
{
|
||||||
use ForwardCompatTestTrait;
|
|
||||||
|
|
||||||
protected static $class;
|
protected static $class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,7 +37,7 @@ abstract class KernelTestCase extends TestCase
|
|||||||
|
|
||||||
protected static $booted;
|
protected static $booted;
|
||||||
|
|
||||||
private function doTearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
static::ensureKernelShutdown();
|
static::ensureKernelShutdown();
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,10 @@ use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
|||||||
*/
|
*/
|
||||||
abstract class WebTestCase extends KernelTestCase
|
abstract class WebTestCase extends KernelTestCase
|
||||||
{
|
{
|
||||||
use ForwardCompatTestTrait;
|
|
||||||
use WebTestAssertionsTrait;
|
use WebTestAssertionsTrait;
|
||||||
use MailerAssertionsTrait;
|
use MailerAssertionsTrait;
|
||||||
|
|
||||||
private function doTearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
self::getClient(null);
|
self::getClient(null);
|
||||||
|
@ -20,14 +20,12 @@ use Symfony\Component\Form\Forms;
|
|||||||
*/
|
*/
|
||||||
abstract class FormIntegrationTestCase extends TestCase
|
abstract class FormIntegrationTestCase extends TestCase
|
||||||
{
|
{
|
||||||
use ForwardCompatTestTrait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var FormFactoryInterface
|
* @var FormFactoryInterface
|
||||||
*/
|
*/
|
||||||
protected $factory;
|
protected $factory;
|
||||||
|
|
||||||
private function doSetUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->factory = Forms::createFormFactoryBuilder()
|
$this->factory = Forms::createFormFactoryBuilder()
|
||||||
->addExtensions($this->getExtensions())
|
->addExtensions($this->getExtensions())
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Symfony package.
|
|
||||||
*
|
|
||||||
* (c) Fabien Potencier <fabien@symfony.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Symfony\Component\Form\Test;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods
|
|
||||||
|
|
||||||
if ((new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
trait ForwardCompatTestTrait
|
|
||||||
{
|
|
||||||
private function doSetUp(): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private function doTearDown(): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
$this->doSetUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
$this->doTearDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
trait ForwardCompatTestTrait
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function doSetUp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function doTearDown()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
$this->doSetUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
$this->doTearDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,8 +17,6 @@ use Symfony\Component\Form\Test\Traits\ValidatorExtensionTrait;
|
|||||||
|
|
||||||
abstract class TypeTestCase extends FormIntegrationTestCase
|
abstract class TypeTestCase extends FormIntegrationTestCase
|
||||||
{
|
{
|
||||||
use ForwardCompatTestTrait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var FormBuilder
|
* @var FormBuilder
|
||||||
*/
|
*/
|
||||||
@ -29,7 +27,7 @@ abstract class TypeTestCase extends FormIntegrationTestCase
|
|||||||
*/
|
*/
|
||||||
protected $dispatcher;
|
protected $dispatcher;
|
||||||
|
|
||||||
private function doSetUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -37,7 +35,7 @@ abstract class TypeTestCase extends FormIntegrationTestCase
|
|||||||
$this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory);
|
$this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function doTearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
if (\in_array(ValidatorExtensionTrait::class, class_uses($this))) {
|
if (\in_array(ValidatorExtensionTrait::class, class_uses($this))) {
|
||||||
$this->validator = null;
|
$this->validator = null;
|
||||||
|
@ -30,8 +30,6 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
abstract class ConstraintValidatorTestCase extends TestCase
|
abstract class ConstraintValidatorTestCase extends TestCase
|
||||||
{
|
{
|
||||||
use ForwardCompatTestTrait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ExecutionContextInterface
|
* @var ExecutionContextInterface
|
||||||
*/
|
*/
|
||||||
@ -51,7 +49,7 @@ abstract class ConstraintValidatorTestCase extends TestCase
|
|||||||
protected $constraint;
|
protected $constraint;
|
||||||
protected $defaultTimezone;
|
protected $defaultTimezone;
|
||||||
|
|
||||||
private function doSetUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->group = 'MyGroup';
|
$this->group = 'MyGroup';
|
||||||
$this->metadata = null;
|
$this->metadata = null;
|
||||||
@ -73,7 +71,7 @@ abstract class ConstraintValidatorTestCase extends TestCase
|
|||||||
$this->setDefaultTimezone('UTC');
|
$this->setDefaultTimezone('UTC');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function doTearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
$this->restoreDefaultTimezone();
|
$this->restoreDefaultTimezone();
|
||||||
}
|
}
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Symfony package.
|
|
||||||
*
|
|
||||||
* (c) Fabien Potencier <fabien@symfony.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Symfony\Component\Validator\Test;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods
|
|
||||||
|
|
||||||
if ((new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
trait ForwardCompatTestTrait
|
|
||||||
{
|
|
||||||
private function doSetUp(): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private function doTearDown(): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
$this->doSetUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
$this->doTearDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
trait ForwardCompatTestTrait
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function doSetUp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function doTearDown()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
$this->doSetUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
$this->doTearDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user