mep
This commit is contained in:
parent
e958163a4a
commit
b8a5a1ff58
79 changed files with 15113 additions and 0 deletions
35
tests/TestCase.php
Normal file
35
tests/TestCase.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use App\Settings;
|
||||
use DI\Bridge\Slim\Bridge;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Slim\App;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
public ContainerInterface $container;
|
||||
public App $app;
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->container = (require __DIR__ . '/../config/container.php')(new Settings(true));
|
||||
$this->app = Bridge::create($this->container);
|
||||
}
|
||||
|
||||
public function setUpDB(): void
|
||||
{
|
||||
$entityManager = $this->container->get(EntityManagerInterface::class);
|
||||
|
||||
// Create schema from entities
|
||||
$metadata = $entityManager->getMetadataFactory()->getAllMetadata();
|
||||
$tool = new SchemaTool($entityManager);
|
||||
$tool->dropSchema($metadata);
|
||||
$tool->createSchema($metadata);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue