mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 22:17:26 +01:00
Continued drafting of fullpersonname
This commit is contained in:
parent
c1b073eba8
commit
e57fd22f78
23
application/src/Entity/Attribut/FirstNameSourceAttribut.php
Normal file
23
application/src/Entity/Attribut/FirstNameSourceAttribut.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
use App\Entity\Source\Data\Name\FirstNameSourceInterface;
|
||||
|
||||
trait FirstNameSourceAttribut
|
||||
{
|
||||
/**
|
||||
* @var FirstNameSourceInterface
|
||||
*/
|
||||
protected $firstNameSource;
|
||||
|
||||
public function getFirstNameSource(): FirstNameSourceInterface
|
||||
{
|
||||
return $this->firstNameSource;
|
||||
}
|
||||
|
||||
public function setFirstNameSource(FirstNameSourceInterface $name): void
|
||||
{
|
||||
$this->firstNameSource = $name;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
use App\Entity\Source\Data\Name\FirstNameSourceInterface;
|
||||
|
||||
interface FirstNameSourceAttributInterface
|
||||
{
|
||||
public function getFirstNameSource(): FirstNameSourceInterface;
|
||||
|
||||
public function setFirstNameSource(FirstNameSourceInterface $name): void;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Combination;
|
||||
|
||||
class FullPersonNameSource extends AbstractCombinationSource implements FullPersonNameSourceInterface
|
||||
{
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Entity\Source\Combination;
|
||||
|
||||
use App\Entity\Source\Data\Name\FirstNameSourceInterface;
|
||||
use App\Entity\Source\Data\Name\SurnameSourceInterface;
|
||||
|
||||
/**
|
||||
@ -12,10 +11,6 @@ use App\Entity\Source\Data\Name\SurnameSourceInterface;
|
||||
*/
|
||||
interface FullPersonNameSourceInterface extends CombinationSourceInterface
|
||||
{
|
||||
public function getFirstName(): FirstNameSourceInterface;
|
||||
|
||||
public function setFirstName(FirstNameSourceInterface $name): void;
|
||||
|
||||
public function getSurname(): SurnameSourceInterface;
|
||||
|
||||
public function setSurname(SurnameSourceInterface $name): void;
|
||||
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Data;
|
||||
|
||||
use App\Entity\Attribut\FullPersonNameSourceAttribut;
|
||||
use App\Entity\Source\Combination\FullPersonNameSourceInterface;
|
||||
use App\Entity\Source\Combination\FullPersonNameSource;
|
||||
|
||||
class PersonIdentitySource extends AbstractDataSource implements PersonIdentitySourceInterface
|
||||
{
|
||||
use FullPersonNameSourceAttribut;
|
||||
|
||||
/**
|
||||
* @var FullPersonNameSourceInterface
|
||||
*/
|
||||
protected $fullPersonNameSource;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->fullPersonNameSource = new FullPersonNameSource();
|
||||
}
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Entity\Source\Data;
|
||||
|
||||
use App\Entity\Attribut\NameAttributInterface;
|
||||
use App\Entity\Attribut\FullPersonNameSourceAttributInterface;
|
||||
|
||||
interface PersonIdentitySourceInterface extends DataSourceInterface, NameAttributInterface
|
||||
interface PersonIdentitySourceInterface extends DataSourceInterface, FullPersonNameSourceAttributInterface
|
||||
{
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Data;
|
||||
|
||||
class PesonIdentitySource extends AbstractDataSource implements PersonIdentitySourceInterface
|
||||
{
|
||||
/**
|
||||
* @Assert\Type(type="App\Entity\Source\NameSource")
|
||||
* @Assert\Valid()
|
||||
* @ORM\OneToOne(targetEntity="NameSource",cascade={"persist", "remove"})
|
||||
* @ORM\JoinColumn(name="name_id", referencedColumnName="id")
|
||||
*
|
||||
* @var NameSourceInterface
|
||||
*/
|
||||
protected $nameSource;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Entity\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\Attribut\FirstNameSourceAttribut;
|
||||
use App\Entity\Attribut\FirstNameSourceAttributInterface;
|
||||
use App\Entity\Source\Data\Name\FirstNameSourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class FirstNameSourceAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var FirstNameSourceAttributInterface
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->name = new class() implements FirstNameSourceAttributInterface {
|
||||
use FirstNameSourceAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->name->getFirstNameSource();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$name = $this->createMock(FirstNameSourceInterface::class);
|
||||
$this->assertNull($this->name->setFirstNameSource($name));
|
||||
$this->assertEquals($name, $this->name->getFirstNameSource());
|
||||
}
|
||||
}
|
@ -34,6 +34,6 @@ class FullPersonNameSourceAttributTest extends TestCase
|
||||
{
|
||||
$fullname = $this->createMock(FullPersonNameSourceInterface::class);
|
||||
$this->assertNull($this->fullname->setFullPersonNameSource($fullname));
|
||||
$this->assertEquals($collection, $this->fullname->getFullPersonNameSource());
|
||||
$this->assertEquals($fullname, $this->fullname->getFullPersonNameSource());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace tests\unit\Entity\Source\Combination;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\Source\Data\PersonIdentitySourceInterface;
|
||||
use App\Entity\Source\Data\PersonIdentitySource;
|
||||
use App\Entity\Source\Combination\FullPersonNameSourceInterface;
|
||||
|
||||
class PersonIdentitySourceTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var PersonIdentitySourceInterface
|
||||
*/
|
||||
public $identitySource;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->userSource = new PersonIdentitySource();
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->assertInstanceOf(FullPersonNameSourceInterface::class, $this->identitySource->getFullPersonNameSource());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user