shlink/config/test/bootstrap_api_tests.php
2019-01-27 12:14:22 +01:00

27 lines
668 B
PHP

<?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\Common;
use Doctrine\ORM\EntityManager;
use Psr\Container\ContainerInterface;
use function file_exists;
use function touch;
// Create an empty .env file
if (! file_exists('.env')) {
touch('.env');
}
/** @var ContainerInterface $container */
$container = require __DIR__ . '/../container.php';
$testHelper = $container->get(TestHelper::class);
$config = $container->get('config');
$testHelper->createTestDb();
$em = $container->get(EntityManager::class);
$testHelper->seedFixtures($em, $config['data_fixtures'] ?? []);
ApiTest\ApiTestCase::setApiClient($container->get('shlink_test_api_client'));