Skip to content

Commit

Permalink
minor symfony#32889 [PhpUnitBridge] Remove use of ForwardCompatTrait …
Browse files Browse the repository at this point in the history
…(jderusse)

This PR was merged into the 3.4 branch.

Discussion
----------

[PhpUnitBridge] Remove use of ForwardCompatTrait

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

With symfony#32882 the ForwardCompatibilityTrait is injected in TestCase which now act as a true polyfill

Commits
-------

ac6242f Remove use of ForwardCompatTrait
  • Loading branch information
nicolas-grekas committed Aug 3, 2019
2 parents b5c5e29 + 165430f commit 6fb0ee3
Show file tree
Hide file tree
Showing 26 changed files with 20 additions and 98 deletions.
3 changes: 0 additions & 3 deletions Tests/Annotation/GroupsTest.php
Expand Up @@ -12,16 +12,13 @@
namespace Symfony\Component\Serializer\Tests\Annotation;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Annotation\Groups;

/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class GroupsTest extends TestCase
{
use ForwardCompatTestTrait;

public function testEmptyGroupsParameter()
{
$this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
Expand Down
3 changes: 0 additions & 3 deletions Tests/Annotation/MaxDepthTest.php
Expand Up @@ -12,16 +12,13 @@
namespace Symfony\Component\Serializer\Tests\Annotation;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Annotation\MaxDepth;

/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class MaxDepthTest extends TestCase
{
use ForwardCompatTestTrait;

public function testNotSetMaxDepthParameter()
{
$this->expectException('Symfony\Component\Serializer\Exception\InvalidArgumentException');
Expand Down
3 changes: 0 additions & 3 deletions Tests/DependencyInjection/SerializerPassTest.php
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\DependencyInjection;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Serializer\DependencyInjection\SerializerPass;
Expand All @@ -24,8 +23,6 @@
*/
class SerializerPassTest extends TestCase
{
use ForwardCompatTestTrait;

public function testThrowExceptionWhenNoNormalizers()
{
$this->expectException('RuntimeException');
Expand Down
5 changes: 1 addition & 4 deletions Tests/Encoder/ChainDecoderTest.php
Expand Up @@ -12,13 +12,10 @@
namespace Symfony\Component\Serializer\Tests\Encoder;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\ChainDecoder;

class ChainDecoderTest extends TestCase
{
use ForwardCompatTestTrait;

const FORMAT_1 = 'format1';
const FORMAT_2 = 'format2';
const FORMAT_3 = 'format3';
Expand All @@ -27,7 +24,7 @@ class ChainDecoderTest extends TestCase
private $decoder1;
private $decoder2;

private function doSetUp()
protected function setUp()
{
$this->decoder1 = $this
->getMockBuilder('Symfony\Component\Serializer\Encoder\DecoderInterface')
Expand Down
5 changes: 1 addition & 4 deletions Tests/Encoder/ChainEncoderTest.php
Expand Up @@ -12,15 +12,12 @@
namespace Symfony\Component\Serializer\Tests\Encoder;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\ChainEncoder;
use Symfony\Component\Serializer\Encoder\EncoderInterface;
use Symfony\Component\Serializer\Encoder\NormalizationAwareInterface;

class ChainEncoderTest extends TestCase
{
use ForwardCompatTestTrait;

const FORMAT_1 = 'format1';
const FORMAT_2 = 'format2';
const FORMAT_3 = 'format3';
Expand All @@ -29,7 +26,7 @@ class ChainEncoderTest extends TestCase
private $encoder1;
private $encoder2;

private function doSetUp()
protected function setUp()
{
$this->encoder1 = $this
->getMockBuilder('Symfony\Component\Serializer\Encoder\EncoderInterface')
Expand Down
5 changes: 1 addition & 4 deletions Tests/Encoder/CsvEncoderTest.php
Expand Up @@ -12,22 +12,19 @@
namespace Symfony\Component\Serializer\Tests\Encoder;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\CsvEncoder;

/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class CsvEncoderTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @var CsvEncoder
*/
private $encoder;

private function doSetUp()
protected function setUp()
{
$this->encoder = new CsvEncoder();
}
Expand Down
5 changes: 1 addition & 4 deletions Tests/Encoder/JsonDecodeTest.php
Expand Up @@ -12,18 +12,15 @@
namespace Symfony\Component\Serializer\Tests\Encoder;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonDecode;
use Symfony\Component\Serializer\Encoder\JsonEncoder;

class JsonDecodeTest extends TestCase
{
use ForwardCompatTestTrait;

/** @var \Symfony\Component\Serializer\Encoder\JsonDecode */
private $decode;

private function doSetUp()
protected function setUp()
{
$this->decode = new JsonDecode();
}
Expand Down
5 changes: 1 addition & 4 deletions Tests/Encoder/JsonEncodeTest.php
Expand Up @@ -12,17 +12,14 @@
namespace Symfony\Component\Serializer\Tests\Encoder;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonEncode;
use Symfony\Component\Serializer\Encoder\JsonEncoder;

class JsonEncodeTest extends TestCase
{
use ForwardCompatTestTrait;

private $encoder;

private function doSetUp()
protected function setUp()
{
$this->encode = new JsonEncode();
}
Expand Down
5 changes: 1 addition & 4 deletions Tests/Encoder/JsonEncoderTest.php
Expand Up @@ -12,19 +12,16 @@
namespace Symfony\Component\Serializer\Tests\Encoder;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
use Symfony\Component\Serializer\Serializer;

class JsonEncoderTest extends TestCase
{
use ForwardCompatTestTrait;

private $encoder;
private $serializer;

private function doSetUp()
protected function setUp()
{
$this->encoder = new JsonEncoder();
$this->serializer = new Serializer([new CustomNormalizer()], ['json' => new JsonEncoder()]);
Expand Down
5 changes: 1 addition & 4 deletions Tests/Encoder/XmlEncoderTest.php
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Encoder;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
Expand All @@ -23,16 +22,14 @@

class XmlEncoderTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @var XmlEncoder
*/
private $encoder;

private $exampleDateTimeString = '2017-02-19T15:16:08+0300';

private function doSetUp()
protected function setUp()
{
$this->encoder = new XmlEncoder();
$serializer = new Serializer([new CustomNormalizer()], ['xml' => new XmlEncoder()]);
Expand Down
3 changes: 0 additions & 3 deletions Tests/Mapping/Factory/CacheMetadataFactoryTest.php
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Mapping\Factory;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
Expand All @@ -24,8 +23,6 @@
*/
class CacheMetadataFactoryTest extends TestCase
{
use ForwardCompatTestTrait;

public function testGetMetadataFor()
{
$metadata = new ClassMetadata(Dummy::class);
Expand Down
5 changes: 1 addition & 4 deletions Tests/Mapping/Loader/AnnotationLoaderTest.php
Expand Up @@ -13,7 +13,6 @@

use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory;
Expand All @@ -23,14 +22,12 @@
*/
class AnnotationLoaderTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @var AnnotationLoader
*/
private $loader;

private function doSetUp()
protected function setUp()
{
$this->loader = new AnnotationLoader(new AnnotationReader());
}
Expand Down
5 changes: 1 addition & 4 deletions Tests/Mapping/Loader/XmlFileLoaderTest.php
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Mapping\Loader;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory;
Expand All @@ -22,8 +21,6 @@
*/
class XmlFileLoaderTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @var XmlFileLoader
*/
Expand All @@ -33,7 +30,7 @@ class XmlFileLoaderTest extends TestCase
*/
private $metadata;

private function doSetUp()
protected function setUp()
{
$this->loader = new XmlFileLoader(__DIR__.'/../../Fixtures/serialization.xml');
$this->metadata = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy');
Expand Down
5 changes: 1 addition & 4 deletions Tests/Mapping/Loader/YamlFileLoaderTest.php
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Serializer\Tests\Mapping\Loader;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory;
Expand All @@ -22,8 +21,6 @@
*/
class YamlFileLoaderTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @var YamlFileLoader
*/
Expand All @@ -33,7 +30,7 @@ class YamlFileLoaderTest extends TestCase
*/
private $metadata;

private function doSetUp()
protected function setUp()
{
$this->loader = new YamlFileLoader(__DIR__.'/../../Fixtures/serialization.yml');
$this->metadata = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy');
Expand Down
5 changes: 1 addition & 4 deletions Tests/Normalizer/AbstractNormalizerTest.php
Expand Up @@ -3,7 +3,6 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Mapping\AttributeMetadata;
use Symfony\Component\Serializer\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
Expand All @@ -26,8 +25,6 @@
*/
class AbstractNormalizerTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @var AbstractNormalizerDummy
*/
Expand All @@ -38,7 +35,7 @@ class AbstractNormalizerTest extends TestCase
*/
private $classMetadata;

private function doSetUp()
protected function setUp()
{
$loader = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Loader\LoaderChain')->setConstructorArgs([[]])->getMock();
$this->classMetadata = $this->getMockBuilder('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory')->setConstructorArgs([$loader])->getMock();
Expand Down
3 changes: 0 additions & 3 deletions Tests/Normalizer/AbstractObjectNormalizerTest.php
Expand Up @@ -13,7 +13,6 @@

use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\PropertyInfo\Type;
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
Expand All @@ -27,8 +26,6 @@

class AbstractObjectNormalizerTest extends TestCase
{
use ForwardCompatTestTrait;

public function testDenormalize()
{
$normalizer = new AbstractObjectNormalizerDummy();
Expand Down
5 changes: 1 addition & 4 deletions Tests/Normalizer/ArrayDenormalizerTest.php
Expand Up @@ -12,14 +12,11 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\SerializerInterface;

class ArrayDenormalizerTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @var ArrayDenormalizer
*/
Expand All @@ -30,7 +27,7 @@ class ArrayDenormalizerTest extends TestCase
*/
private $serializer;

private function doSetUp()
protected function setUp()
{
$this->serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer')->getMock();
$this->denormalizer = new ArrayDenormalizer();
Expand Down
5 changes: 1 addition & 4 deletions Tests/Normalizer/CustomNormalizerTest.php
Expand Up @@ -12,21 +12,18 @@
namespace Symfony\Component\Serializer\Tests\Normalizer;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Tests\Fixtures\ScalarDummy;

class CustomNormalizerTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @var CustomNormalizer
*/
private $normalizer;

private function doSetUp()
protected function setUp()
{
$this->normalizer = new CustomNormalizer();
$this->normalizer->setSerializer(new Serializer());
Expand Down

0 comments on commit 6fb0ee3

Please sign in to comment.