From 777ac302e7d3e36bb1f8a542cce7c26e93f4afca Mon Sep 17 00:00:00 2001 From: MarioRadu Date: Fri, 3 Nov 2023 12:45:29 +0200 Subject: [PATCH] throw exception if in-memory database when running tests --- test/Functional/AbstractFunctionalTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/Functional/AbstractFunctionalTest.php b/test/Functional/AbstractFunctionalTest.php index 8d40509..cdea483 100644 --- a/test/Functional/AbstractFunctionalTest.php +++ b/test/Functional/AbstractFunctionalTest.php @@ -25,6 +25,7 @@ use Psr\Container\NotFoundExceptionInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; +use RuntimeException; use function array_merge; use function getenv; @@ -54,6 +55,12 @@ public function setUp(): void $this->initPipeline(); $this->initRoutes(); + if ($this->isTestMode() && ! $this->getEntityManager()->getConnection()->getParams()['memory']) { + throw new RuntimeException( + 'You are running tests in a non in-memory database. + Did you forgot to create the local.test.php file?' + ); + } if (method_exists($this, 'runMigrations')) { $this->runMigrations(); }