Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatibility with Symfony 4 #576

Merged
merged 1 commit into from
Jun 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ matrix:
env: SYMFONY_VERSION='2.8'
- php: 5.6
env: SYMFONY_VERSION='3.0'
- php: 7.1
env: SYMFONY_VERSION='~4.0@dev'
- php: 5.5
env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"'

Expand Down
3 changes: 2 additions & 1 deletion Tests/ContextFactory/ConfiguredContextFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

use JMS\Serializer\Context;
use JMS\SerializerBundle\ContextFactory\ConfiguredContextFactory;
use PHPUnit\Framework\TestCase;

/**
* Class ConfiguredContextFactoryTest
*/
class ConfiguredContextFactoryTest extends \PHPUnit_Framework_TestCase
class ConfiguredContextFactoryTest extends TestCase
{
/**
* testCreateSerializationContext
Expand Down
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@

use JMS\SerializerBundle\DependencyInjection\Configuration;
use JMS\SerializerBundle\JMSSerializerBundle;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class ConfigurationTest extends \PHPUnit_Framework_TestCase
class ConfigurationTest extends TestCase
{
private function getContainer(array $configs = array())
{
Expand Down
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/CustomHandlerPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
use JMS\Serializer\Exception\RuntimeException;
use JMS\SerializerBundle\DependencyInjection\Compiler\CustomHandlersPass;
use JMS\SerializerBundle\DependencyInjection\JMSSerializerExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class CustomHandlerPassTest extends \PHPUnit_Framework_TestCase
class CustomHandlerPassTest extends TestCase
{
/**
* @param array $configs
Expand Down
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/DoctrinePassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@

use JMS\SerializerBundle\DependencyInjection\Compiler\DoctrinePass;
use JMS\SerializerBundle\DependencyInjection\JMSSerializerExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class DoctrinePassTest extends \PHPUnit_Framework_TestCase
class DoctrinePassTest extends TestCase
{
/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@

use JMS\SerializerBundle\DependencyInjection\Compiler\RegisterEventListenersAndSubscribersPass;
use JMS\SerializerBundle\DependencyInjection\JMSSerializerExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class EventSubscribersAndListenersPassTest extends \PHPUnit_Framework_TestCase
class EventSubscribersAndListenersPassTest extends TestCase
{
/**
* @param array $configs
Expand Down
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/JMSSerializerExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
use JMS\SerializerBundle\Tests\DependencyInjection\Fixture\ObjectUsingExpressionProperties;
use JMS\SerializerBundle\Tests\DependencyInjection\Fixture\SimpleObject;
use JMS\SerializerBundle\Tests\DependencyInjection\Fixture\VersionedObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpKernel\KernelInterface;

class JMSSerializerExtensionTest extends \PHPUnit_Framework_TestCase
class JMSSerializerExtensionTest extends TestCase
{
protected function setUp()
{
Expand Down
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/NamingStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
use JMS\Serializer\Metadata\PropertyMetadata;
use JMS\Serializer\Naming\PropertyNamingStrategyInterface;
use JMS\SerializerBundle\DependencyInjection\JMSSerializerExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class NamingStrategyTest extends \PHPUnit_Framework_TestCase
class NamingStrategyTest extends TestCase
{
/**
*
Expand Down
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/TwigExtensionPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@

use JMS\SerializerBundle\DependencyInjection\Compiler\TwigExtensionPass;
use JMS\SerializerBundle\DependencyInjection\JMSSerializerExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class TwigExtensionPassTest extends \PHPUnit_Framework_TestCase
class TwigExtensionPassTest extends TestCase
{
/**
* @return ContainerBuilder
Expand Down
3 changes: 2 additions & 1 deletion Tests/ExpressionLanguage/ExpressionLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
namespace JMS\SerializerBundle\Tests\ExpressionLanguage;

use JMS\SerializerBundle\ExpressionLanguage\BasicSerializerFunctionsProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;

class ExpressionLanguageTest extends \PHPUnit_Framework_TestCase
class ExpressionLanguageTest extends TestCase
{
public function testFunctionProviderCompilation()
{
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"php": ">=5.4.0",
"jms/serializer": "^1.7",
"phpoption/phpoption": "^1.1.0",
"symfony/framework-bundle": "~2.3|~3.0"
"symfony/framework-bundle": "~2.3|~3.0|~4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.2|^5.0",
"symfony/expression-language": "~2.6|~3.0",
"phpunit/phpunit": "^4.8.35|^5.4.3|^6.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of curiosity, is there any special reason to require explicitly 4.8.35 or 5.4.3 instead of 4.8, 5.4 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need ^6.0 to be able to install the Yaml component in version 4 (older PHPUnit versions depended on 2.x/3.x while PHPUnit 6 completely dropped the requirement of the Yaml component). However, PHPUnit 6 does not have the old \PHPUnit_Framework_TestCase class so that we need to change the base class of all test cases to use the TestCase class from the PHPUnit\Framework namespace. This in turn requires us to bump the dependency for PHPUnit 4 and 5 to releases that included class aliases for the namespaced TestCase class as a FC layer.

Copy link
Collaborator

@goetas goetas May 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-/ I was (and still I am) OK with the changes for phpunit 6.0 ( and for the changes required for it), my question was about the changes regarding 4.8 and 5.4

😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to explain the whole reasoning here in case someone find this change in the future and needs some explanation. :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goetas I think the changes for 4.8 and 5.4 are needed because only starting with those, the class aliases have been set-up.

"symfony/expression-language": "~2.6|~3.0|~4.0",
"symfony/yaml": "*",
"symfony/browser-kit": "*",
"symfony/class-loader": "*",
Expand All @@ -37,6 +37,7 @@
"symfony/validator": "*",
"symfony/stopwatch": "*"
},
"minimum-stability": "dev",
"suggest": {
"jms/di-extra-bundle": "Required to get lazy loading (de)serialization visitors, ~1.3"
},
Expand Down