mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 09:19:08 +00:00 
			
		
		
		
	Implemented childs attribute test and code formating
This commit is contained in:
		| @@ -0,0 +1,36 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Entity\Attribut; | ||||
|  | ||||
| use PHPUnit\Framework\TestCase; | ||||
| use App\Entity\Attribut\ChildsAttributeInterface; | ||||
| use App\Entity\Attribut\ChildsAttribut; | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
|  | ||||
| class ChildsAttributTest extends TestCase | ||||
| { | ||||
|     /** | ||||
|      * @var ChildsAttributeInterface | ||||
|      */ | ||||
|     protected $childs; | ||||
|  | ||||
|     public function setUp(): void | ||||
|     { | ||||
|         $this->childs = new class() implements ChildsAttributeInterface { | ||||
|             use ChildsAttribut; | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     public function testConstructor(): void | ||||
|     { | ||||
|         $this->expectException(\TypeError::class); | ||||
|         $this->childs->getChilds(); | ||||
|     } | ||||
|  | ||||
|     public function testAccessors(): void | ||||
|     { | ||||
|         $childs = new ArrayCollection(); | ||||
|         $this->assertNull($this->childs->setChilds($childs)); | ||||
|         $this->assertEquals($childs, $this->childs->getChilds()); | ||||
|     } | ||||
| } | ||||
| @@ -1,4 +1,5 @@ | ||||
| <?php | ||||
|  | ||||
| namespace tests\Unit\Entity\Meta; | ||||
|  | ||||
| use PHPUnit\Framework\TestCase; | ||||
| @@ -9,20 +10,20 @@ use Doctrine\Common\Collections\Collection; | ||||
| class RelationTest extends TestCase | ||||
| { | ||||
|     /** | ||||
|      *  | ||||
|      * @var RelationInterface | ||||
|      */ | ||||
|     protected $relation; | ||||
|      | ||||
|     public function setUp():void{ | ||||
|  | ||||
|     public function setUp(): void | ||||
|     { | ||||
|         $this->relation = new Relation(); | ||||
|     } | ||||
|      | ||||
|     public function testConstructor():void { | ||||
|  | ||||
|     public function testConstructor(): void | ||||
|     { | ||||
|         $this->assertInstanceOf(Collection::class, $this->relation->getChilds()); | ||||
|         $this->assertInstanceOf(Collection::class, $this->relation->getParents()); | ||||
|         $this->expectException(\TypeError::class); | ||||
|         $this->relation->getSource(); | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user