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

Update symfony 4 compatibility #38

Merged
merged 4 commits into from
Nov 8, 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
18 changes: 8 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,23 @@ matrix:
env: ENABLE_CODE_COVERAGE="yes"
# oldest supported versions
- php: 7.0
env: COMPOSER_FLAGS="--prefer-lowest"
env:
- SYMFONY_VERSION="2.8.*"
- COMPOSER_FLAGS="--prefer-lowest"
- SYMFONY_PHPUNIT_VERSION=5.7
# common versions:
- php: 7.1
env: SYMFONY_VERSION="2.8.*"
- php: 7.1
env: SYMFONY_VERSION="3.2.*"
- php: 7.1
env: SYMFONY_VERSION="3.3.*"
# most recent versions
- php: 7.1
env: CHECK_PHP_SYNTAX="yes"
env: SYMFONY_VERSION="3.4.*" CHECK_PHP_SYNTAX="yes"
- php: 7.2
env: SYMFONY_VERSION="4.0.*"
# bleeding edge (unreleased dev versions where failures are allowed)
- php: 7.1
env: SYMFONY_VERSION="3.4.*"
- php: nightly
env: SYMFONY_VERSION="4.0.*"
allow_failures:
- php: nightly
- env: SYMFONY_VERSION="3.4.*"

cache:
directories:
Expand All @@ -46,7 +44,7 @@ cache:
before_install:
- if [[ "$ENABLE_CODE_COVERAGE" != "yes" ]]; then phpenv config-rm xdebug.ini || true; fi;
- if [[ "$SYMFONY_VERSION" != "" ]]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
- if [[ "$TRAVIS_PHP_VERSION" == "nightly" ]]; then composer remove "friendsofphp/php-cs-fixer" --no-update --no-interaction --dev; fi;
- if [[ "$CHECK_PHP_SYNTAX" != "yes" ]]; then composer remove "friendsofphp/php-cs-fixer" --no-update --no-interaction --dev; fi;

install:
- composer update --prefer-dist --no-interaction --optimize-autoloader --prefer-stable --no-progress $COMPOSER_FLAGS
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@
"symfony/phpunit-bridge": "^3.2|^4.0",
"symfony/browser-kit": "^2.8|^3.1|^4.0",
"symfony/css-selector": "^2.8|^3.1|^4.0",
"symfony/console": "^2.8|^3.0|^4.0",
"symfony/dependency-injection": "^2.8|^3.1|^4.0",
"symfony/doctrine-bridge": "^2.8|^3.1|^4.0",
"symfony/dom-crawler": "^2.8.1|^3.1|^4.0",
"symfony/filesystem": "^2.8|^3.1|^4.0",
"symfony/finder": "^2.8|^3.1|^4.0",
"symfony/form": "^2.8.5|^3.1|^4.0",
"symfony/framework-bundle": "^2.8|^3.1|^4.0",
"symfony/http-foundation": "^2.8|^3.1|^4.0",
Expand Down
5 changes: 5 additions & 0 deletions tests/Fixtures/Integration/Symfony/app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ doctrine:
orm:
auto_generate_proxy_classes: '%kernel.debug%'
auto_mapping: true

services:
logger:
class: Psr\Log\NullLogger
public: false
3 changes: 2 additions & 1 deletion tests/Integration/Bridge/Faker/Provider/EnumProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
use Faker\Factory as FakerGeneratorFactory;
use Faker\Generator as FakerGenerator;
use Nelmio\Alice\Loader\NativeLoader;
use PHPUnit\Framework\TestCase;

class EnumProviderTest extends \PHPUnit_Framework_TestCase
class EnumProviderTest extends TestCase
{
public function testEnumProvider()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/AutoDiscoveredValuesTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
use Elao\Enum\Enum;
use Elao\Enum\FlaggedEnum;
use Elao\Enum\Tests\Fixtures\Enum\Php71AutoDiscoveredEnum;
use PHPUnit\Framework\TestCase;

class AutoDiscoveredValuesTraitTest extends \PHPUnit_Framework_TestCase
class AutoDiscoveredValuesTraitTest extends TestCase
{
public function testItAutoDiscoveredValuesBasedOnAvailableConstants()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Bridge/Doctrine/DBAL/Types/EnumTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
use Doctrine\DBAL\Types\Type;
use Elao\Enum\Tests\Fixtures\Bridge\Doctrine\DBAL\Types\GenderEnumType;
use Elao\Enum\Tests\Fixtures\Enum\Gender;
use PHPUnit\Framework\TestCase;

class EnumTypeTest extends \PHPUnit_Framework_TestCase
class EnumTypeTest extends TestCase
{
/** @var AbstractPlatform */
protected $platform;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
use Doctrine\DBAL\Types\Type;
use Elao\Enum\Tests\Fixtures\Bridge\Doctrine\DBAL\Types\SimpleEnumType;
use Elao\Enum\Tests\Fixtures\Enum\SimpleEnum;
use PHPUnit\Framework\TestCase;

class IntegerEnumTypeTest extends \PHPUnit_Framework_TestCase
class IntegerEnumTypeTest extends TestCase
{
/** @var AbstractPlatform */
protected $platform;
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Bridge/Faker/Provider/EnumProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
use Elao\Enum\Bridge\Faker\Provider\EnumProvider;
use Elao\Enum\Tests\Fixtures\Enum\Permissions;
use Elao\Enum\Tests\Fixtures\Enum\SimpleEnum;
use PHPUnit\Framework\TestCase;

class EnumProviderTest extends \PHPUnit_Framework_TestCase
class EnumProviderTest extends TestCase
{
public function testEnumMethodShouldReturnExpectedEnums()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
use Elao\Enum\Bridge\Symfony\Form\DataTransformer\BitmaskToBitFlagsValueTransformer;
use Elao\Enum\Tests\Fixtures\Enum\Gender;
use Elao\Enum\Tests\Fixtures\Enum\Permissions;
use PHPUnit\Framework\TestCase;

class BitmaskToBitFlagsValueTransformerTest extends \PHPUnit_Framework_TestCase
class BitmaskToBitFlagsValueTransformerTest extends TestCase
{
/**
* @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
use Elao\Enum\Bridge\Symfony\Form\DataTransformer\SingleToCollectionFlagEnumTransformer;
use Elao\Enum\Tests\Fixtures\Enum\Gender;
use Elao\Enum\Tests\Fixtures\Enum\Permissions;
use PHPUnit\Framework\TestCase;

class SingleToCollectionFlagEnumTransformerTest extends \PHPUnit_Framework_TestCase
class SingleToCollectionFlagEnumTransformerTest extends TestCase
{
/**
* @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

use Elao\Enum\Bridge\Symfony\Serializer\Normalizer\EnumNormalizer;
use Elao\Enum\Tests\Fixtures\Enum\Gender;
use PHPUnit\Framework\TestCase;

class EnumNormalizerTest extends \PHPUnit_Framework_TestCase
class EnumNormalizerTest extends TestCase
{
/** @var EnumNormalizer */
private $normalizer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace Elao\Enum\Tests\Unit\Bridge\Symfony\Validator\Constraint;

use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\ConstraintValidatorInterface;
Expand All @@ -29,11 +31,13 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* To be removed when <3.2 support is dropped.
*
* @see https://github.com/symfony/symfony/blob/3.2/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
abstract class ConstraintValidatorTestCase extends \PHPUnit_Framework_TestCase
abstract class ConstraintValidatorTestCase extends TestCase
{
/**
* @var ExecutionContextInterface
Expand Down Expand Up @@ -321,12 +325,12 @@ public function assertRaised()

$violations = iterator_to_array($this->context->getViolations());

\PHPUnit_Framework_Assert::assertSame($expectedCount = count($expected), $violationsCount = count($violations), sprintf('%u violation(s) expected. Got %u.', $expectedCount, $violationsCount));
Assert::assertSame($expectedCount = count($expected), $violationsCount = count($violations), sprintf('%u violation(s) expected. Got %u.', $expectedCount, $violationsCount));

reset($violations);

foreach ($expected as $violation) {
\PHPUnit_Framework_Assert::assertEquals($violation, current($violations));
Assert::assertEquals($violation, current($violations));
next($violations);
}
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Bridge/Symfony/Validator/Constraint/EnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

use Elao\Enum\Bridge\Symfony\Validator\Constraint\Enum;
use Elao\Enum\Tests\Fixtures\Enum\SimpleEnum;
use PHPUnit\Framework\TestCase;

class EnumTest extends \PHPUnit_Framework_TestCase
class EnumTest extends TestCase
{
public function testDefaultValueIsEnumClass()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
use Elao\Enum\Tests\Fixtures\Enum\Gender;
use Elao\Enum\Tests\Fixtures\Enum\Permissions;
use Elao\Enum\Tests\Fixtures\Enum\SimpleEnum;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;

class EnumCasterTest extends \PHPUnit_Framework_TestCase
class EnumCasterTest extends TestCase
{
use VarDumperTestTrait;

Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/EnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

use Elao\Enum\Tests\Fixtures\Enum\ExtendedSimpleEnum;
use Elao\Enum\Tests\Fixtures\Enum\SimpleEnum;
use PHPUnit\Framework\TestCase;

class EnumTest extends \PHPUnit_Framework_TestCase
class EnumTest extends TestCase
{
public function enumValuesProvider()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/FlaggedEnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
use Elao\Enum\Tests\Fixtures\Enum\AlarmScheduleType;
use Elao\Enum\Tests\Fixtures\Enum\InvalidFlagsEnum;
use Elao\Enum\Tests\Fixtures\Enum\Permissions;
use PHPUnit\Framework\TestCase;

class FlaggedEnumTest extends \PHPUnit_Framework_TestCase
class FlaggedEnumTest extends TestCase
{
/**
* @expectedException \Elao\Enum\Exception\InvalidValueException
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/ReadableEnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
namespace Elao\Enum\Tests\Unit;

use Elao\Enum\Tests\Fixtures\Enum\Gender;
use PHPUnit\Framework\TestCase;

class ReadableEnumTest extends \PHPUnit_Framework_TestCase
class ReadableEnumTest extends TestCase
{
public function enumValuesProvider()
{
Expand Down