mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 01:09:41 +00:00 
			
		
		
		
	Added draft for Identity and Names
This commit is contained in:
		| @@ -0,0 +1,8 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Combination; | ||||
|  | ||||
| use App\Entity\Source\AbstractSource; | ||||
|  | ||||
| abstract class AbstractCombinationSource extends AbstractSource implements CombinationSourceInterface  | ||||
| { | ||||
| } | ||||
| @@ -0,0 +1,9 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Combination; | ||||
|  | ||||
| use App\Entity\Source\Data\DataSourceInterface; | ||||
|  | ||||
| interface CombinationSourceInterface extends DataSourceInterface | ||||
| { | ||||
| } | ||||
|  | ||||
| @@ -0,0 +1,21 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Combination; | ||||
|  | ||||
| use App\Entity\Source\Data\Name\FirstNameSourceInterface; | ||||
| use App\Entity\Source\Data\Name\SurnameSourceInterface; | ||||
|  | ||||
| /** | ||||
|  * @todo Maybe a middle name would be helpfull in the future ;)  | ||||
|  * @author kevinfrantz | ||||
|  * | ||||
|  */ | ||||
| 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,8 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Data; | ||||
|  | ||||
| use App\Entity\Attribut\NameAttributInterface; | ||||
|  | ||||
| interface IdentityInterface extends DataSourceInterface, NameAttributInterface | ||||
| { | ||||
| } | ||||
| @@ -0,0 +1,8 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Data; | ||||
|  | ||||
| class IdentitySource extends AbstractDataSource implements IdentityInterface | ||||
| { | ||||
|      | ||||
| } | ||||
|  | ||||
| @@ -0,0 +1,9 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Data\Name; | ||||
|  | ||||
| use App\Entity\Source\Data\AbstractDataSource; | ||||
|  | ||||
| class AbstractNameSource extends AbstractDataSource implements NameSourceInterface | ||||
| { | ||||
| } | ||||
|  | ||||
| @@ -0,0 +1,7 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Data\Name; | ||||
|  | ||||
| interface FirstNameSourceInterface extends NameSourceInterface | ||||
| { | ||||
| } | ||||
|  | ||||
| @@ -0,0 +1,9 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Data\Name; | ||||
|  | ||||
| use App\Entity\Source\Data\DataSourceInterface; | ||||
| use App\Entity\Attribut\NameAttributInterface; | ||||
|  | ||||
| interface NameSourceInterface extends DataSourceInterface, NameAttributInterface | ||||
| { | ||||
| } | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace App\Entity\Source\Data; | ||||
| namespace App\Entity\Source\Data\Name; | ||||
| 
 | ||||
| use App\Entity\Attribut\NameAttribut; | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| @@ -11,14 +11,14 @@ use Symfony\Component\Validator\Constraints as Assert; | ||||
|  * @ORM\Table(name="source_data_name") | ||||
|  * @ORM\Entity(repositoryClass="App\Repository\NameSourceRepository") | ||||
|  */ | ||||
| final class NameSource extends AbstractDataSource implements NameSourceInterface | ||||
| final class NicknameSource extends AbstractNameSource implements NicknameSourceInterface | ||||
| { | ||||
|     use NameAttribut; | ||||
| 
 | ||||
|     /** | ||||
|      * @todo Implement an extra assert Layer! | ||||
|      * @ORM\Column(type="string",length=255) | ||||
|      * @Assert\NotBlank() | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $name; | ||||
| @@ -0,0 +1,10 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Entity\Source\Data\Name; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| interface NicknameSourceInterface extends NameSourceInterface | ||||
| { | ||||
| } | ||||
| @@ -0,0 +1,7 @@ | ||||
| <?php | ||||
| namespace App\Entity\Source\Data\Name; | ||||
|  | ||||
| interface SurnameSourceInterface extends NameSourceInterface | ||||
| { | ||||
| } | ||||
|  | ||||
| @@ -1,12 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Entity\Source\Data; | ||||
|  | ||||
| use App\Entity\Attribut\NameAttributInterface; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| interface NameSourceInterface extends NameAttributInterface, DataSourceInterface | ||||
| { | ||||
| } | ||||
| @@ -0,0 +1,30 @@ | ||||
| <?php | ||||
| namespace tests\unit\Entity\Source\Data; | ||||
|  | ||||
| use PHPUnit\Framework\TestCase; | ||||
| use App\Entity\Source\Data\IdentityInterface; | ||||
| use App\Entity\Source\Data\IdentitySource; | ||||
| use App\Entity\Source\Data\FullPersonNameSourceInterface; | ||||
|  | ||||
| class IdentitySourceTest extends TestCase | ||||
| { | ||||
|     /** | ||||
|      * @var IdentityInterface | ||||
|      */ | ||||
|     protected $identity; | ||||
|      | ||||
|     public function setUp():void{ | ||||
|         $this->identity = new IdentitySource(); | ||||
|     } | ||||
|      | ||||
|     public function testConstructor():void{ | ||||
|         $this->assertInstanceOf(FullPersonNameSourceInterface::class, $this->identity->getName()); | ||||
|     } | ||||
|      | ||||
|     public function testName():void{ | ||||
|         $name = $this->createMock(FullPersonNameSourceInterface::class); | ||||
|         $this->assertNull($this->identity->setName($name)); | ||||
|         $this->assertEquals($name, $this->identity->getName()); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user