Optimized unit tests and entity implementation

This commit is contained in:
Kevin Frantz 2018-11-20 23:17:57 +01:00
parent aab188688c
commit 9a3801152f
3 changed files with 10 additions and 1 deletions

View File

@ -33,7 +33,7 @@ class FullPersonNameSource extends AbstractCombinationSource implements FullPers
* *
* @var FirstNameSourceInterface * @var FirstNameSourceInterface
*/ */
protected $firstnNameSource; protected $firstNameSource;
public function __construct() public function __construct()
{ {

View File

@ -9,7 +9,9 @@ use Symfony\Component\Validator\Constraints as Assert;
/** /**
* @author kevinfrantz * @author kevinfrantz
*
* @todo Change to SINGLE_TABLE. JOINED was necessary because SINGLE_TABLE leaded to: * @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 >> * @see << SQLSTATE[42S02]: Base table or view not found: 1146 Table 'DEV_DATABASE.source_data_name' doesn't exist >>
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="source_data_name") * @ORM\Table(name="source_data_name")

View File

@ -7,6 +7,7 @@ use Doctrine\ORM\EntityManager;
use App\Repository\UserRepository; use App\Repository\UserRepository;
use App\Entity\User; use App\Entity\User;
use App\Entity\UserInterface; use App\Entity\UserInterface;
use App\Entity\Source\Combination\PersonIdentitySourceInterface;
class UserRepositoryTest extends KernelTestCase class UserRepositoryTest extends KernelTestCase
{ {
@ -42,6 +43,12 @@ class UserRepositoryTest extends KernelTestCase
$user->setUsername('Karl Marx'); $user->setUsername('Karl Marx');
$user->setEmail('mew21@test.de'); $user->setEmail('mew21@test.de');
$user->setPassword('Friedrich ist kein Engel!:)'); $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->persist($user);
$this->entityManager->flush(); $this->entityManager->flush();
$userId = $user->getId(); $userId = $user->getId();