diff --git a/application/src/Entity/Attribut/FullPersonNameSourceAttribut.php b/application/src/Entity/Attribut/FullPersonNameSourceAttribut.php new file mode 100644 index 0000000..5a8aff6 --- /dev/null +++ b/application/src/Entity/Attribut/FullPersonNameSourceAttribut.php @@ -0,0 +1,23 @@ +fullPersonNameSource; + } + + public function setFullPersonNameSource(FullPersonNameSourceInterface $fullname): void + { + $this->fullPersonNameSource = $fullname; + } +} diff --git a/application/src/Entity/Attribut/FullPersonNameSourceAttributInterface.php b/application/src/Entity/Attribut/FullPersonNameSourceAttributInterface.php new file mode 100644 index 0000000..74f9675 --- /dev/null +++ b/application/src/Entity/Attribut/FullPersonNameSourceAttributInterface.php @@ -0,0 +1,12 @@ +personIdentitySource; + } + + public function setPersonIdentitySource(PersonIdentitySourceInterface $identity): void + { + $this->personIdentitySource = $identity; + } +} diff --git a/application/src/Entity/Attribut/PersonIdentitySourceAttributInterface.php b/application/src/Entity/Attribut/PersonIdentitySourceAttributInterface.php new file mode 100644 index 0000000..2039a6f --- /dev/null +++ b/application/src/Entity/Attribut/PersonIdentitySourceAttributInterface.php @@ -0,0 +1,12 @@ +nameSource = new NameSource(); parent::__construct(); } } diff --git a/application/src/Entity/Source/Combination/UserSourceInterface.php b/application/src/Entity/Source/Combination/UserSourceInterface.php index 6d3e157..22808c6 100644 --- a/application/src/Entity/Source/Combination/UserSourceInterface.php +++ b/application/src/Entity/Source/Combination/UserSourceInterface.php @@ -3,11 +3,11 @@ namespace App\Entity\Source\Data; use App\Entity\Attribut\UserAttributInterface; -use App\Entity\Attribut\NameSourceAttributInterface; +use App\Entity\Attribut\PersonIdentitySourceAttributInterface; /** * @author kevinfrantz */ -interface UserSourceInterface extends DataSourceInterface, UserAttributInterface, NameSourceAttributInterface +interface UserSourceInterface extends DataSourceInterface, UserAttributInterface, PersonIdentitySourceAttributInterface { } diff --git a/application/src/Entity/Source/Data/Name/AbstractNameSource.php b/application/src/Entity/Source/Data/Name/AbstractNameSource.php index 864bfc2..c851230 100644 --- a/application/src/Entity/Source/Data/Name/AbstractNameSource.php +++ b/application/src/Entity/Source/Data/Name/AbstractNameSource.php @@ -1,4 +1,5 @@ fullname = new class() implements FullPersonNameSourceAttributInterface { + use FullPersonNameSourceAttribut; + }; + } + + public function testConstructor(): void + { + $this->expectException(\TypeError::class); + $this->fullname->getFullPersonNameSource(); + } + + public function testAccessors(): void + { + $fullname = $this->createMock(FullPersonNameSourceInterface::class); + $this->assertNull($this->fullname->setFullPersonNameSource($fullname)); + $this->assertEquals($collection, $this->fullname->getFullPersonNameSource()); + } +} diff --git a/application/tests/Unit/Entity/Attribut/PersonIdentitySourceAttributTest.php b/application/tests/Unit/Entity/Attribut/PersonIdentitySourceAttributTest.php new file mode 100644 index 0000000..5a7a003 --- /dev/null +++ b/application/tests/Unit/Entity/Attribut/PersonIdentitySourceAttributTest.php @@ -0,0 +1,41 @@ +identity = new class() implements PersonIdentitySourceAttributInterface { + use PersonIdentityAttribut; + }; + } + + public function testConstructor(): void + { + $this->expectException(\TypeError::class); + $this->identity->getIdentitySource(); + } + + public function testAccessors(): void + { + $identity = $this->createMock(PersonIdentitySourceInterface::class); + $this->assertNull($this->identity->setIdentitySource($identity)); + $this->assertEquals($collection, $this->identity->getIdentitySource()); + } +} diff --git a/application/tests/Unit/Entity/Source/Data/UserSourceTest.php b/application/tests/Unit/Entity/Source/Combination/UserSourceTest.php similarity index 73% rename from application/tests/Unit/Entity/Source/Data/UserSourceTest.php rename to application/tests/Unit/Entity/Source/Combination/UserSourceTest.php index 4acd747..9c87583 100644 --- a/application/tests/Unit/Entity/Source/Data/UserSourceTest.php +++ b/application/tests/Unit/Entity/Source/Combination/UserSourceTest.php @@ -1,12 +1,12 @@ assertInstanceOf(Collection::class, $this->userSource->getMemberships()); - $this->assertInstanceOf(NameSourceInterface::class, $this->userSource->getNameSource()); + $this->assertInstanceOf(PersonIdentitySourceInterface::class, $this->userSource->getIdentitySource()); $this->expectException(\TypeError::class); $this->userSource->getUser(); } diff --git a/application/tests/Unit/Entity/Source/Data/IdentitySourceTest.php b/application/tests/Unit/Entity/Source/Data/IdentitySourceTest.php index 04dd4f3..3b7a460 100644 --- a/application/tests/Unit/Entity/Source/Data/IdentitySourceTest.php +++ b/application/tests/Unit/Entity/Source/Data/IdentitySourceTest.php @@ -1,4 +1,5 @@ identity = new IdentitySource(); } - - public function testConstructor():void{ + + public function testConstructor(): void + { $this->assertInstanceOf(FullPersonNameSourceInterface::class, $this->identity->getName()); } - - public function testName():void{ + + public function testName(): void + { $name = $this->createMock(FullPersonNameSourceInterface::class); $this->assertNull($this->identity->setName($name)); $this->assertEquals($name, $this->identity->getName()); } } -