Updated to phpunit 7 and dropped dbunit dependency

This commit is contained in:
Alejandro Celaya 2018-03-26 19:09:10 +02:00
parent 6cf0155417
commit 1b2a0820e5
2 changed files with 4 additions and 28 deletions

View file

@ -50,9 +50,8 @@
"filp/whoops": "^2.0", "filp/whoops": "^2.0",
"infection/infection": "^0.8.1", "infection/infection": "^0.8.1",
"phpstan/phpstan": "0.9", "phpstan/phpstan": "0.9",
"phpunit/dbunit": "^3.0", "phpunit/phpcov": "^5.0",
"phpunit/phpcov": "^4.0", "phpunit/phpunit": "^7.0",
"phpunit/phpunit": "^6.0",
"slevomat/coding-standard": "^4.0", "slevomat/coding-standard": "^4.0",
"squizlabs/php_codesniffer": "^3.1 <3.2", "squizlabs/php_codesniffer": "^3.1 <3.2",
"symfony/dotenv": "^3.4", "symfony/dotenv": "^3.4",

View file

@ -3,40 +3,17 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\Common\DbUnit; namespace ShlinkioTest\Shlink\Common\DbUnit;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\DbUnit\Database\Connection as DbConn; use PHPUnit\Framework\TestCase;
use PHPUnit\DbUnit\DataSet\IDataSet as DataSet;
use PHPUnit\DbUnit\TestCase;
abstract class DatabaseTestCase extends TestCase abstract class DatabaseTestCase extends TestCase
{ {
const ENTITIES_TO_EMPTY = []; protected const ENTITIES_TO_EMPTY = [];
/** /**
* @var EntityManagerInterface * @var EntityManagerInterface
*/ */
public static $em; 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 protected function getEntityManager(): EntityManagerInterface
{ {