diff --git a/application/src/Entity/Attribut/FirstNameSourceAttribut.php b/application/src/Entity/Attribut/FirstNameSourceAttribut.php new file mode 100644 index 0000000..742dee3 --- /dev/null +++ b/application/src/Entity/Attribut/FirstNameSourceAttribut.php @@ -0,0 +1,23 @@ +firstNameSource; + } + + public function setFirstNameSource(FirstNameSourceInterface $name): void + { + $this->firstNameSource = $name; + } +} diff --git a/application/src/Entity/Attribut/FirstNameSourceAttributInterface.php b/application/src/Entity/Attribut/FirstNameSourceAttributInterface.php new file mode 100644 index 0000000..6e93e6c --- /dev/null +++ b/application/src/Entity/Attribut/FirstNameSourceAttributInterface.php @@ -0,0 +1,12 @@ +fullPersonNameSource = new FullPersonNameSource(); + } +} diff --git a/application/src/Entity/Source/Combination/PersonIdentitySourceInterface.php b/application/src/Entity/Source/Combination/PersonIdentitySourceInterface.php index 447d122..cd90c0b 100644 --- a/application/src/Entity/Source/Combination/PersonIdentitySourceInterface.php +++ b/application/src/Entity/Source/Combination/PersonIdentitySourceInterface.php @@ -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 { } diff --git a/application/src/Entity/Source/Combination/PesonIdentitySource.php b/application/src/Entity/Source/Combination/PesonIdentitySource.php deleted file mode 100644 index fe551b5..0000000 --- a/application/src/Entity/Source/Combination/PesonIdentitySource.php +++ /dev/null @@ -1,16 +0,0 @@ -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()); + } +} diff --git a/application/tests/Unit/Entity/Attribut/FullPersonNameSourceAttributTest.php b/application/tests/Unit/Entity/Attribut/FullPersonNameSourceAttributTest.php index 9db8027..51c961c 100644 --- a/application/tests/Unit/Entity/Attribut/FullPersonNameSourceAttributTest.php +++ b/application/tests/Unit/Entity/Attribut/FullPersonNameSourceAttributTest.php @@ -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()); } } diff --git a/application/tests/Unit/Entity/Source/Combination/PersonIdentitySourceTest.php b/application/tests/Unit/Entity/Source/Combination/PersonIdentitySourceTest.php new file mode 100644 index 0000000..6d370e0 --- /dev/null +++ b/application/tests/Unit/Entity/Source/Combination/PersonIdentitySourceTest.php @@ -0,0 +1,26 @@ +userSource = new PersonIdentitySource(); + } + + public function testConstructor(): void + { + $this->assertInstanceOf(FullPersonNameSourceInterface::class, $this->identitySource->getFullPersonNameSource()); + } +}