Skip to content

Commit

Permalink
throw exception if in-memory database when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRadu committed Nov 3, 2023
1 parent 2e5c0f1 commit 777ac30
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/Functional/AbstractFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 777ac30

Please sign in to comment.