Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRadu committed Nov 6, 2023
1 parent 777ac30 commit 9803c56
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions test/Functional/AbstractFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@ 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?'
);
}
$this->ensureTestMode();

if (method_exists($this, 'runMigrations')) {
$this->runMigrations();
}
Expand Down Expand Up @@ -139,6 +135,26 @@ protected function getContainer(): ContainerInterface|ServiceManager
return $this->container;
}

/**
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws RuntimeException
*/
private function ensureTestMode(): void
{
if (! $this->isTestMode()) {
throw new RuntimeException(
'You are running tests, but test mode is NOT enabled. Did you forget to create local.test.php?'
);
}

if (! $this->getEntityManager()->getConnection()->getParams()['memory'] ?? false) {
throw new RuntimeException(
'You are running tests in a non in-memory database. Did you forget to create local.test.php?'
);
}
}

protected function get(
string $uri,
array $queryParams = [],
Expand Down

0 comments on commit 9803c56

Please sign in to comment.