Simplified database tests by updating to shlinkio/shlink-test-utils 2

This commit is contained in:
Alejandro Celaya 2021-01-13 20:21:24 +01:00
parent da9e9df4ba
commit c5fc8fbf00
5 changed files with 5 additions and 32 deletions

View File

@ -71,7 +71,7 @@
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-master", "roave/security-advisories": "dev-master",
"shlinkio/php-coding-standard": "~2.1.1", "shlinkio/php-coding-standard": "~2.1.1",
"shlinkio/shlink-test-utils": "^1.7", "shlinkio/shlink-test-utils": "^2.0",
"symfony/var-dumper": "^5.2", "symfony/var-dumper": "^5.2",
"veewee/composer-run-parallel": "^0.1.0" "veewee/composer-run-parallel": "^0.1.0"
}, },

View File

@ -15,11 +15,9 @@ use Shlinkio\Shlink\TestUtils\DbTest\DatabaseTestCase;
class DomainRepositoryTest extends DatabaseTestCase class DomainRepositoryTest extends DatabaseTestCase
{ {
protected const ENTITIES_TO_EMPTY = [ShortUrl::class, Domain::class, ApiKey::class];
private DomainRepository $repo; private DomainRepository $repo;
protected function setUp(): void protected function beforeEach(): void
{ {
$this->repo = $this->getEntityManager()->getRepository(Domain::class); $this->repo = $this->getEntityManager()->getRepository(Domain::class);
} }

View File

@ -29,17 +29,9 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
{ {
use TagManagerTrait; use TagManagerTrait;
protected const ENTITIES_TO_EMPTY = [
Tag::class,
Visit::class,
ShortUrl::class,
Domain::class,
ApiKey::class,
];
private ShortUrlRepository $repo; private ShortUrlRepository $repo;
public function setUp(): void public function beforeEach(): void
{ {
$this->repo = $this->getEntityManager()->getRepository(ShortUrl::class); $this->repo = $this->getEntityManager()->getRepository(ShortUrl::class);
} }

View File

@ -21,17 +21,9 @@ use function array_chunk;
class TagRepositoryTest extends DatabaseTestCase class TagRepositoryTest extends DatabaseTestCase
{ {
protected const ENTITIES_TO_EMPTY = [
Visit::class,
ShortUrl::class,
Tag::class,
ApiKey::class,
Domain::class,
];
private TagRepository $repo; private TagRepository $repo;
protected function setUp(): void protected function beforeEach(): void
{ {
$this->repo = $this->getEntityManager()->getRepository(Tag::class); $this->repo = $this->getEntityManager()->getRepository(Tag::class);
} }

View File

@ -27,18 +27,9 @@ use function sprintf;
class VisitRepositoryTest extends DatabaseTestCase class VisitRepositoryTest extends DatabaseTestCase
{ {
protected const ENTITIES_TO_EMPTY = [
VisitLocation::class,
Visit::class,
ShortUrl::class,
Domain::class,
Tag::class,
ApiKey::class,
];
private VisitRepository $repo; private VisitRepository $repo;
protected function setUp(): void protected function beforeEach(): void
{ {
$this->repo = $this->getEntityManager()->getRepository(Visit::class); $this->repo = $this->getEntityManager()->getRepository(Visit::class);
} }