This commit is contained in:
lubiana 2025-05-31 21:43:13 +02:00
parent e958163a4a
commit b8a5a1ff58
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
79 changed files with 15113 additions and 0 deletions

35
tests/TestCase.php Normal file
View 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);
}
}