mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 09:19:08 +00:00 
			
		
		
		
	Implemented test and constructor for FullPersonNameSource
This commit is contained in:
		| @@ -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; | ||||
|     } | ||||
|   | ||||
| @@ -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; | ||||
| } | ||||
|   | ||||
| @@ -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(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,42 @@ | ||||
| <?php | ||||
|  | ||||
| namespace tests\unit\Entity\Source\Combination; | ||||
|  | ||||
| use PHPUnit\Framework\TestCase; | ||||
| use App\Entity\Source\Combination\FullPersonNameSourceInterface; | ||||
| use App\Entity\Source\Combination\FullPersonNameSource; | ||||
| use App\Entity\Source\Data\Name\SurnameSourceInterface; | ||||
| use App\Entity\Source\Data\Name\FirstNameSourceInterface; | ||||
|  | ||||
| class FullPersonNameSourceTest extends TestCase | ||||
| { | ||||
|     /** | ||||
|      * @var FullPersonNameSourceInterface | ||||
|      */ | ||||
|     protected $name; | ||||
|  | ||||
|     public function setUp(): void | ||||
|     { | ||||
|         $this->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()); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user