mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 01:09:41 +00:00 
			
		
		
		
	Added RequestedRightAttribut
This commit is contained in:
		
							
								
								
									
										34
									
								
								application/symfony/src/Attribut/RequestedRightAttribut.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								application/symfony/src/Attribut/RequestedRightAttribut.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Attribut; | ||||
|  | ||||
| use App\Domain\RequestManagement\Right\RequestedRightInterface; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  * | ||||
|  * @see RequestedRightAttributInterface | ||||
|  */ | ||||
| trait RequestedRightAttribut | ||||
| { | ||||
|     /** | ||||
|      * @var RequestedRightInterface | ||||
|      */ | ||||
|     protected $requestedRight; | ||||
|  | ||||
|     /** | ||||
|      * @param RequestedRightInterface $requestedRight | ||||
|      */ | ||||
|     public function setRequestedRight(RequestedRightInterface $requestedRight): void | ||||
|     { | ||||
|         $this->requestedRight = $requestedRight; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return RequestedRightInterface | ||||
|      */ | ||||
|     public function getRequestedRight(): RequestedRightInterface | ||||
|     { | ||||
|         return $this->requestedRight; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,21 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Attribut; | ||||
|  | ||||
| use App\Domain\RequestManagement\Right\RequestedRightInterface; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| interface RequestedRightAttributInterface | ||||
| { | ||||
|     /** | ||||
|      * @param RequestedRightInterface $requestedRight | ||||
|      */ | ||||
|     public function setRequestedRight(RequestedRightInterface $requestedRight): void; | ||||
|  | ||||
|     /** | ||||
|      * @return RequestedRightInterface | ||||
|      */ | ||||
|     public function getRequestedRight(): RequestedRightInterface; | ||||
| } | ||||
| @@ -0,0 +1,39 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tests\Unit\Attribut; | ||||
|  | ||||
| use PHPUnit\Framework\TestCase; | ||||
| use App\Domain\RequestManagement\Right\RequestedRightInterface; | ||||
| use App\Attribut\RequestedRightAttributInterface; | ||||
| use App\Attribut\RequestedRightAttribut; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| class RequestedRightAttributTest extends TestCase | ||||
| { | ||||
|     /** | ||||
|      * @var RequestedRightAttributInterface | ||||
|      */ | ||||
|     protected $requestedRightAttribut; | ||||
|  | ||||
|     public function setUp(): void | ||||
|     { | ||||
|         $this->requestedRightAttribut = new class() implements RequestedRightAttributInterface { | ||||
|             use RequestedRightAttribut; | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     public function testConstructor(): void | ||||
|     { | ||||
|         $this->expectException(\TypeError::class); | ||||
|         $this->requestedRightAttribut->getRequestedRight(); | ||||
|     } | ||||
|  | ||||
|     public function testAccessors(): void | ||||
|     { | ||||
|         $requestedRight = $this->createMock(RequestedRightInterface::class); | ||||
|         $this->assertNull($this->requestedRightAttribut->setRequestedRight($requestedRight)); | ||||
|         $this->assertEquals($reciever, $this->requestedRightAttribut->getRequestedRight()); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user