From a33a7f16ad4f45d4a76862b2d84f214793c0c466 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Wed, 10 Jul 2019 13:10:32 +0200 Subject: [PATCH] drop old vendor versions See issue #81 --- .travis.yml | 10 ++-- README.md | 4 +- composer.json | 16 +++---- .../PHPUnit/PHPUnitListener.php | 48 +++++-------------- 4 files changed, 27 insertions(+), 51 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9d12ef1..8f007b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,15 +7,13 @@ services: - mysql php: - - 7.1 - 7.2 - 7.3 env: - SYMFONY_VERSION="3.4.*" - SYMFONY_VERSION="4.3.*" - - PHPUNIT_VERSION="6.*" - - PHPUNIT_VERSION="7.*" + - PHPUNIT_VERSION="8.*" matrix: include: @@ -24,13 +22,13 @@ matrix: - TEST_COVERAGE=true - php: 7.3 env: - - PHPUNIT_VERSION="8.*" - - SYMFONY_VERSION="4.3.*" + - PHPUNIT_VERSION="7.*" + - SYMFONY_VERSION="3.4.*" install: - rm -rf composer.lock vendor/* - phpenv config-rm xdebug.ini || echo "xDebug not disabled" - - export COMPOSER_MEMORY_LIMIT=-1 && composer require symfony/symfony:${SYMFONY_VERSION:-"3.3.*"} phpunit/phpunit:${PHPUNIT_VERSION:-"7.*"} + - export COMPOSER_MEMORY_LIMIT=-1 && composer require symfony/symfony:${SYMFONY_VERSION:-"4.3.*"} phpunit/phpunit:${PHPUNIT_VERSION:-"8.*"} script: - cp tests/Functional/parameters.yml.dist tests/Functional/parameters.yml diff --git a/README.md b/README.md index 993e1fe..9ffeb3b 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,9 @@ It also includes a `StaticArrayCache` that will be automatically configured as m ``` -4. Make sure you also have `phpunit/phpunit` available as a `dev` dependency (**versions 6, 7 and 8 are supported with the built in listener/extension**) to run your tests. +4. Make sure you also have `phpunit/phpunit` available as a `dev` dependency (**versions 7 and 8 are supported with the built in listener/extension**) to run your tests. Alternatively this bundle is also compatible with `symfony/phpunit-bridge` and its `simple-phpunit` script. - (Note: you may need to make sure the phpunit-bridge requires the correct PHPUnit 6+ Version using the environment variable `SYMFONY_PHPUNIT_VERSION`). + (Note: you may need to make sure the phpunit-bridge requires the correct PHPUnit 7+ Version using the environment variable `SYMFONY_PHPUNIT_VERSION`). 5. That's it! From now on whatever changes you do to the database within each single testcase (be it a `WebTestCase` or a `KernelTestCase` or any custom test) are automatically rolled back for you :blush: diff --git a/composer.json b/composer.json index 1617bf6..512f93c 100644 --- a/composer.json +++ b/composer.json @@ -11,15 +11,15 @@ } ], "require": { - "php": "^7.1", - "symfony/framework-bundle": "~2.7|~3.0|~4.0", - "doctrine/dbal": "~2.5", - "doctrine/doctrine-bundle": "~1.4" + "php": "^7.2", + "symfony/framework-bundle": "~3.0|~4.0", + "doctrine/dbal": "~2.9", + "doctrine/doctrine-bundle": "~1.11" }, "require-dev": { - "phpunit/phpunit": "~6.0|~7.0|~8.0", - "symfony/yaml": "~2.8|~3.0|~4.0", - "symfony/phpunit-bridge": "~2.8|~3.0|~4.0" + "phpunit/phpunit": "~7.0|~8.0", + "symfony/yaml": "~3.0|~4.0", + "symfony/phpunit-bridge": "~4.3" }, "autoload": { "psr-4": { @@ -31,7 +31,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.1.x-dev" + "dev-master": "6.1.x-dev" } } } diff --git a/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitListener.php b/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitListener.php index 796d44c..f1a6553 100644 --- a/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitListener.php +++ b/src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitListener.php @@ -4,44 +4,22 @@ use DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver; -if (class_exists('\PHPUnit\Framework\BaseTestListener')) { - // PHPUnit 6 - class PHPUnitListener extends \PHPUnit\Framework\BaseTestListener - { - public function startTest(\PHPUnit\Framework\Test $test) - { - StaticDriver::beginTransaction(); - } - - public function endTest(\PHPUnit\Framework\Test $test, $time) - { - StaticDriver::rollBack(); - } +class PHPUnitListener implements \PHPUnit\Framework\TestListener +{ + use \PHPUnit\Framework\TestListenerDefaultImplementation; - public function startTestSuite(\PHPUnit\Framework\TestSuite $suite) - { - StaticDriver::setKeepStaticConnections(true); - } - } -} elseif (trait_exists('\PHPUnit\Framework\TestListenerDefaultImplementation')) { - // PHPUnit 7+ - class PHPUnitListener implements \PHPUnit\Framework\TestListener + public function startTest(\PHPUnit\Framework\Test $test): void { - use \PHPUnit\Framework\TestListenerDefaultImplementation; - - public function startTest(\PHPUnit\Framework\Test $test): void - { - StaticDriver::beginTransaction(); - } + StaticDriver::beginTransaction(); + } - public function endTest(\PHPUnit\Framework\Test $test, float $time): void - { - StaticDriver::rollBack(); - } + public function endTest(\PHPUnit\Framework\Test $test, float $time): void + { + StaticDriver::rollBack(); + } - public function startTestSuite(\PHPUnit\Framework\TestSuite $suite): void - { - StaticDriver::setKeepStaticConnections(true); - } + public function startTestSuite(\PHPUnit\Framework\TestSuite $suite): void + { + StaticDriver::setKeepStaticConnections(true); } }