From f6978628b9e819c252d5181d001c95bcf828b720 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 20 Jan 2019 13:07:45 +0100 Subject: [PATCH] Optimized test coverage for LayerRepositoryFactoryService on 100% --- .../LayerRepositoryFactoryServiceTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/symfony/tests/Unit/Domain/RepositoryManagement/LayerRepositoryFactoryServiceTest.php b/application/symfony/tests/Unit/Domain/RepositoryManagement/LayerRepositoryFactoryServiceTest.php index 1b29dfa..b221a6c 100644 --- a/application/symfony/tests/Unit/Domain/RepositoryManagement/LayerRepositoryFactoryServiceTest.php +++ b/application/symfony/tests/Unit/Domain/RepositoryManagement/LayerRepositoryFactoryServiceTest.php @@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use App\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface; use App\Domain\RepositoryManagement\LayerRepositoryFactoryService; use App\Repository\RepositoryInterface; +use App\Exception\NotSetException; /** * @author kevinfrantz @@ -26,9 +27,11 @@ class LayerRepositoryFactoryServiceTest extends KernelTestCase public function testGetRepository(): void { - foreach (LayerRepositoryFactoryService::LAYER_CLASS_MAP as $layer => $class) { + foreach (array_keys(LayerRepositoryFactoryService::LAYER_CLASS_MAP) as $layer) { $repositoy = $this->layerRepositoryFactoryService->getRepository($layer); $this->assertInstanceOf(RepositoryInterface::class, $repositoy); } + $this->expectException(NotSetException::class); + $repositoy = $this->layerRepositoryFactoryService->getRepository('UnknownLayer'); } }