From 9a3801152fec339e1fa5123b29fca14231e6c2a2 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Tue, 20 Nov 2018 23:17:57 +0100 Subject: [PATCH] Optimized unit tests and entity implementation --- .../src/Entity/Source/Combination/FullPersonNameSource.php | 2 +- .../src/Entity/Source/Data/Name/AbstractNameSource.php | 2 ++ application/tests/Unit/Repository/UserRepositoryTest.php | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/application/src/Entity/Source/Combination/FullPersonNameSource.php b/application/src/Entity/Source/Combination/FullPersonNameSource.php index 6f3daac..2ce1df9 100644 --- a/application/src/Entity/Source/Combination/FullPersonNameSource.php +++ b/application/src/Entity/Source/Combination/FullPersonNameSource.php @@ -33,7 +33,7 @@ class FullPersonNameSource extends AbstractCombinationSource implements FullPers * * @var FirstNameSourceInterface */ - protected $firstnNameSource; + protected $firstNameSource; public function __construct() { diff --git a/application/src/Entity/Source/Data/Name/AbstractNameSource.php b/application/src/Entity/Source/Data/Name/AbstractNameSource.php index ccf1807..a757482 100644 --- a/application/src/Entity/Source/Data/Name/AbstractNameSource.php +++ b/application/src/Entity/Source/Data/Name/AbstractNameSource.php @@ -9,7 +9,9 @@ use Symfony\Component\Validator\Constraints as Assert; /** * @author kevinfrantz + * * @todo Change to SINGLE_TABLE. JOINED was necessary because SINGLE_TABLE leaded to: + * * @see << SQLSTATE[42S02]: Base table or view not found: 1146 Table 'DEV_DATABASE.source_data_name' doesn't exist >> * @ORM\Entity * @ORM\Table(name="source_data_name") diff --git a/application/tests/Unit/Repository/UserRepositoryTest.php b/application/tests/Unit/Repository/UserRepositoryTest.php index ccc8a7d..b82e40e 100644 --- a/application/tests/Unit/Repository/UserRepositoryTest.php +++ b/application/tests/Unit/Repository/UserRepositoryTest.php @@ -7,6 +7,7 @@ use Doctrine\ORM\EntityManager; use App\Repository\UserRepository; use App\Entity\User; use App\Entity\UserInterface; +use App\Entity\Source\Combination\PersonIdentitySourceInterface; class UserRepositoryTest extends KernelTestCase { @@ -42,6 +43,12 @@ class UserRepositoryTest extends KernelTestCase $user->setUsername('Karl Marx'); $user->setEmail('mew21@test.de'); $user->setPassword('Friedrich ist kein Engel!:)'); + /** + * @var PersonIdentitySourceInterface + */ + $personIdentity = $user->getSource()->getPersonIdentitySource(); + $personIdentity->getFullPersonNameSource()->getFirstNameSource()->setName('Karl'); + $personIdentity->getFullPersonNameSource()->getSurnameSource()->setName('Marx'); $this->entityManager->persist($user); $this->entityManager->flush(); $userId = $user->getId();