Optimized LayerRepositoryFactoryService

This commit is contained in:
Kevin Frantz
2019-01-20 13:33:33 +01:00
parent 86198ff2df
commit 5301be7614
12 changed files with 123 additions and 63 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace tests\Unit\Domain\RepositoryManagement;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use App\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface;
use App\Domain\RepositoryManagement\LayerRepositoryFactoryService;
use App\Repository\RepositoryInterface;
/**
* @author kevinfrantz
*/
class LayerRepositoryFactoryServiceTest extends KernelTestCase
{
/**
* @var LayerRepositoryFactoryServiceInterface
*/
private $layerRepositoryFactoryService;
public function setUp(): void
{
self::bootKernel();
$entityManager = self::$container->get('doctrine')->getManager();
$this->layerRepositoryFactoryService = new LayerRepositoryFactoryService($entityManager);
}
public function testGetRepository(): void
{
foreach (LayerRepositoryFactoryService::LAYER_CLASS_MAP as $layer => $class) {
$repositoy = $this->layerRepositoryFactoryService->getRepository($layer);
$this->assertInstanceOf(RepositoryInterface::class, $repositoy);
}
}
}