Skip to content

Commit

Permalink
drop old vendor versions (#86)
Browse files Browse the repository at this point in the history
See issue #81
  • Loading branch information
garak authored and dmaicher committed Jul 10, 2019
1 parent dc4be5f commit 39de47f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 51 deletions.
10 changes: 4 additions & 6 deletions .travis.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -59,9 +59,9 @@ It also includes a `StaticArrayCache` that will be automatically configured as m
</phpunit>
```

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:

Expand Down
16 changes: 8 additions & 8 deletions composer.json
Expand Up @@ -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": {
Expand All @@ -31,7 +31,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "5.1.x-dev"
"dev-master": "6.1.x-dev"
}
}
}
48 changes: 13 additions & 35 deletions src/DAMA/DoctrineTestBundle/PHPUnit/PHPUnitListener.php
Expand Up @@ -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);
}
}

0 comments on commit 39de47f

Please sign in to comment.