mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Implemented tests for personIdentitySource and solved conflicts
This commit is contained in:
parent
a92ac68750
commit
08c4bee43f
@ -12,7 +12,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
* @ORM\Table(name="source_combination")
|
* @ORM\Table(name="source_combination")
|
||||||
* @ORM\InheritanceType("JOINED")
|
* @ORM\InheritanceType("JOINED")
|
||||||
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
||||||
* @ORM\DiscriminatorMap({"user" = "UserSource","fullpersonname" = "FullPersonNameSource"})
|
* @ORM\DiscriminatorMap({"user" = "UserSource","fullpersonname" = "FullPersonNameSource","personidentitysource"="PersonIdentitySource"})
|
||||||
*/
|
*/
|
||||||
abstract class AbstractCombinationSource extends AbstractSource implements CombinationSourceInterface
|
abstract class AbstractCombinationSource extends AbstractSource implements CombinationSourceInterface
|
||||||
{
|
{
|
||||||
|
@ -3,9 +3,14 @@
|
|||||||
namespace App\Entity\Source\Combination;
|
namespace App\Entity\Source\Combination;
|
||||||
|
|
||||||
use App\Entity\Attribut\FullPersonNameSourceAttribut;
|
use App\Entity\Attribut\FullPersonNameSourceAttribut;
|
||||||
use App\Entity\Source\Data\AbstractDataSource;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
class PersonIdentitySource extends AbstractDataSource implements PersonIdentitySourceInterface
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
* @ORM\Table(name="source_combination_person_identity")
|
||||||
|
* @ORM\Entity()
|
||||||
|
*/
|
||||||
|
class PersonIdentitySource extends AbstractCombinationSource implements PersonIdentitySourceInterface
|
||||||
{
|
{
|
||||||
use FullPersonNameSourceAttribut;
|
use FullPersonNameSourceAttribut;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class UserSource extends AbstractCombinationSource implements UserSourceInterfac
|
|||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement ORM mapping for database!
|
* @ORM\OneToOne(targetEntity="PersonIdentitySource",cascade={"persist", "remove"})
|
||||||
*
|
*
|
||||||
* @var PersonIdentitySourceInterface
|
* @var PersonIdentitySourceInterface
|
||||||
*/
|
*/
|
||||||
|
@ -20,6 +20,11 @@ class UserRepositoryTest extends KernelTestCase
|
|||||||
*/
|
*/
|
||||||
protected $userRepository;
|
protected $userRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var UserInterface
|
||||||
|
*/
|
||||||
|
protected $loadedUser;
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
$kernel = self::bootKernel();
|
$kernel = self::bootKernel();
|
||||||
@ -40,14 +45,22 @@ class UserRepositoryTest extends KernelTestCase
|
|||||||
$this->entityManager->persist($user);
|
$this->entityManager->persist($user);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
$userId = $user->getId();
|
$userId = $user->getId();
|
||||||
/**
|
/*
|
||||||
* @var UserInterface
|
* @var UserInterface
|
||||||
*/
|
*/
|
||||||
$loadedUser = $this->userRepository->find($userId);
|
$this->loadedUser = $this->userRepository->find($userId);
|
||||||
$this->assertEquals($userId, $loadedUser->getId());
|
$this->assertEquals($userId, $this->loadedUser->getId());
|
||||||
$this->entityManager->remove($loadedUser);
|
$this->assertGreaterThan(0, $this->loadedUser->getSource()->getId());
|
||||||
$this->entityManager->flush();
|
$this->assertGreaterThan(0, $this->loadedUser->getSource()->getPersonIdentitySource()->getId());
|
||||||
|
$this->deleteUser();
|
||||||
$this->assertNull($this->userRepository->find($userId));
|
$this->assertNull($this->userRepository->find($userId));
|
||||||
|
$this->loadedUser = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteUser(): void
|
||||||
|
{
|
||||||
|
$this->entityManager->remove($this->loadedUser);
|
||||||
|
$this->entityManager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user