diff --git a/application/src/Entity/Attribut/SurnameSourceAttribut.php b/application/src/Entity/Attribut/SurnameSourceAttribut.php index e66d900..76f23d8 100644 --- a/application/src/Entity/Attribut/SurnameSourceAttribut.php +++ b/application/src/Entity/Attribut/SurnameSourceAttribut.php @@ -11,12 +11,12 @@ trait SurnameSourceAttribut */ protected $surnameSource; - public function getSurname(): SurnameSourceInterface + public function getSurnameSource(): SurnameSourceInterface { return $this->surnameSource; } - public function setSurname(SurnameSourceInterface $name): void + public function setSurnameSource(SurnameSourceInterface $name): void { $this->surnameSource = $name; } diff --git a/application/src/Entity/Attribut/SurnameSourceAttributInterface.php b/application/src/Entity/Attribut/SurnameSourceAttributInterface.php index c7bbd5a..b51cf6a 100644 --- a/application/src/Entity/Attribut/SurnameSourceAttributInterface.php +++ b/application/src/Entity/Attribut/SurnameSourceAttributInterface.php @@ -6,7 +6,7 @@ use App\Entity\Source\Data\Name\SurnameSourceInterface; interface SurnameSourceAttributInterface { - public function getSurname(): SurnameSourceInterface; + public function getSurnameSource(): SurnameSourceInterface; - public function setSurname(SurnameSourceInterface $name): void; + public function setSurnameSource(SurnameSourceInterface $name): void; } diff --git a/application/src/Entity/Source/Combination/FullPersonNameSource.php b/application/src/Entity/Source/Combination/FullPersonNameSource.php index 94e9cb3..f173374 100644 --- a/application/src/Entity/Source/Combination/FullPersonNameSource.php +++ b/application/src/Entity/Source/Combination/FullPersonNameSource.php @@ -4,8 +4,17 @@ namespace App\Entity\Source\Combination; use App\Entity\Attribut\FirstNameSourceAttribut; use App\Entity\Attribut\SurnameSourceAttribut; +use App\Entity\Source\Data\Name\SurnameSource; +use App\Entity\Source\Data\Name\FirstNameSource; class FullPersonNameSource extends AbstractCombinationSource implements FullPersonNameSourceInterface { use FirstNameSourceAttribut,SurnameSourceAttribut; + + public function __construct() + { + parent::__construct(); + $this->surnameSource = new SurnameSource(); + $this->firstNameSource = new FirstNameSource(); + } } diff --git a/application/tests/Unit/Entity/Source/Combination/FullPersonNameSourceTest.php b/application/tests/Unit/Entity/Source/Combination/FullPersonNameSourceTest.php new file mode 100644 index 0000000..ac4b898 --- /dev/null +++ b/application/tests/Unit/Entity/Source/Combination/FullPersonNameSourceTest.php @@ -0,0 +1,42 @@ +name = new FullPersonNameSource(); + } + + public function testConstructor(): void + { + $this->assertInstanceOf(SurnameSourceInterface::class, $this->name->getSurnameSource()); + $this->assertInstanceOf(FirstNameSourceInterface::class, $this->name->getFirstNameSource()); + } + + public function testFirstNameAccessor(): void + { + $name = $this->createMock(FirstNameSourceInterface::class); + $this->assertNull($this->name->setFirstNameSource($name)); + $this->assertEquals($name, $this->name->getFirstNameSource()); + } + + public function testSurnameAccessor(): void + { + $name = $this->createMock(SurnameSourceInterface::class); + $this->assertNull($this->name->setSurnameSource($name)); + $this->assertEquals($name, $this->name->getSurnameSource()); + } +}