From 1b2a0820e5b12a826d9605c41ed4e02c993c9d8c Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 26 Mar 2018 19:09:10 +0200 Subject: [PATCH] Updated to phpunit 7 and dropped dbunit dependency --- composer.json | 5 ++-- .../test-func/DbUnit/DatabaseTestCase.php | 27 ++----------------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index 7e5bfc12..f57d5c34 100644 --- a/composer.json +++ b/composer.json @@ -50,9 +50,8 @@ "filp/whoops": "^2.0", "infection/infection": "^0.8.1", "phpstan/phpstan": "0.9", - "phpunit/dbunit": "^3.0", - "phpunit/phpcov": "^4.0", - "phpunit/phpunit": "^6.0", + "phpunit/phpcov": "^5.0", + "phpunit/phpunit": "^7.0", "slevomat/coding-standard": "^4.0", "squizlabs/php_codesniffer": "^3.1 <3.2", "symfony/dotenv": "^3.4", diff --git a/module/Common/test-func/DbUnit/DatabaseTestCase.php b/module/Common/test-func/DbUnit/DatabaseTestCase.php index 58a10bdc..89ee871f 100644 --- a/module/Common/test-func/DbUnit/DatabaseTestCase.php +++ b/module/Common/test-func/DbUnit/DatabaseTestCase.php @@ -3,40 +3,17 @@ declare(strict_types=1); namespace ShlinkioTest\Shlink\Common\DbUnit; -use Doctrine\DBAL\Driver\PDOConnection; use Doctrine\ORM\EntityManagerInterface; -use PHPUnit\DbUnit\Database\Connection as DbConn; -use PHPUnit\DbUnit\DataSet\IDataSet as DataSet; -use PHPUnit\DbUnit\TestCase; +use PHPUnit\Framework\TestCase; abstract class DatabaseTestCase extends TestCase { - const ENTITIES_TO_EMPTY = []; + protected const ENTITIES_TO_EMPTY = []; /** * @var EntityManagerInterface */ public static $em; - /** - * @var DbConn - */ - private static $conn; - - public function getConnection(): DbConn - { - if (isset(self::$conn)) { - return self::$conn; - } - - /** @var PDOConnection $pdo */ - $pdo = static::$em->getConnection()->getWrappedConnection(); - return self::$conn = $this->createDefaultDBConnection($pdo, static::$em->getConnection()->getDatabase()); - } - - public function getDataSet(): DataSet - { - return $this->createArrayDataSet([]); - } protected function getEntityManager(): EntityManagerInterface {