28 lines
686 B
PHP
28 lines
686 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Support;
|
|
|
|
use App\Bootstrap;
|
|
use App\Config\ConfigLoader;
|
|
use App\Config\ConfigValidator;
|
|
use App\Shared\Clock\TimeProvider;
|
|
use Psr\Container\ContainerInterface;
|
|
use Slim\App;
|
|
|
|
final class TestAppFactory
|
|
{
|
|
public static function create(\PDO $pdo, TimeProvider $timeProvider): App
|
|
{
|
|
$repoRoot = dirname(__DIR__, 3);
|
|
$container = Bootstrap::buildContainer([
|
|
\PDO::class => $pdo,
|
|
TimeProvider::class => $timeProvider,
|
|
ConfigLoader::class => new ConfigLoader(new ConfigValidator(), $repoRoot . '/config'),
|
|
]);
|
|
|
|
return Bootstrap::createApp($container);
|
|
}
|
|
}
|