mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 09:19:08 +00:00 
			
		
		
		
	Implemented TreeCollectionSource
This commit is contained in:
		| @@ -5,8 +5,8 @@ namespace Tests\Unit\Entity\Attribut; | ||||
| use PHPUnit\Framework\TestCase; | ||||
| use App\Entity\Attribut\MembershipsAttributInterface; | ||||
| use App\Entity\Attribut\MembershipsAttribut; | ||||
| use App\Entity\Source\Collection\MemberCollectionSourceInterface; | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use App\Entity\Source\Collection\TreeCollectionSourceInterface; | ||||
|  | ||||
| class MembershipsAttributTest extends TestCase | ||||
| { | ||||
| @@ -30,7 +30,7 @@ class MembershipsAttributTest extends TestCase | ||||
|  | ||||
|     public function testAccessors(): void | ||||
|     { | ||||
|         $membership = $this->createMock(MemberCollectionSourceInterface::class); | ||||
|         $membership = $this->createMock(TreeCollectionSourceInterface::class); | ||||
|         $this->assertNull($this->memberships->setMemberships(new ArrayCollection([$membership]))); | ||||
|         $this->assertEquals($this->memberships->getMemberships()->get(0), $membership); | ||||
|     } | ||||
|   | ||||
| @@ -1,42 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tests\Unit\Entity\Source\Collection; | ||||
|  | ||||
| use PHPUnit\Framework\TestCase; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use App\Entity\Source\AbstractSource; | ||||
| use App\Entity\Source\Collection\MemberCollectionSourceInterface; | ||||
| use App\Entity\Source\Collection\MemberCollectionSource; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| class MemberCollectionSourceTest extends TestCase | ||||
| { | ||||
|     /** | ||||
|      * @var MemberCollectionSourceInterface | ||||
|      */ | ||||
|     protected $groupSource; | ||||
|  | ||||
|     public function setUp(): void | ||||
|     { | ||||
|         $this->groupSource = new MemberCollectionSource(); | ||||
|     } | ||||
|  | ||||
|     public function testConstructor(): void | ||||
|     { | ||||
|         $this->assertInstanceOf(Collection::class, $this->groupSource->getMembers()); | ||||
|     } | ||||
|  | ||||
|     public function testMembers() | ||||
|     { | ||||
|         $member = new class() extends AbstractSource { | ||||
|         }; | ||||
|         $this->groupSource->setMembers(new ArrayCollection([ | ||||
|             $member, | ||||
|         ])); | ||||
|         $this->assertEquals($member, $this->groupSource->getMembers() | ||||
|             ->get(0)); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,45 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tests\Unit\Entity\Source\Collection; | ||||
|  | ||||
| use PHPUnit\Framework\TestCase; | ||||
| use Doctrine\Common\Collections\Collection; | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use App\Entity\Source\AbstractSource; | ||||
| use App\Entity\Source\Collection\TreeCollectionSourceInterface; | ||||
| use App\Entity\Source\Collection\TreeCollectionSource; | ||||
| use App\Helper\DimensionHelperInterface; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| class TreeCollectionSourceTest extends TestCase | ||||
| { | ||||
|     /** | ||||
|      * @var TreeCollectionSourceInterface | ||||
|      */ | ||||
|     protected $tree; | ||||
|  | ||||
|     public function setUp(): void | ||||
|     { | ||||
|         $this->tree = new TreeCollectionSource(); | ||||
|     } | ||||
|  | ||||
|     public function testConstructor(): void | ||||
|     { | ||||
|         $this->assertInstanceOf(Collection::class, $this->tree->getMembers()); | ||||
|         $this->assertInstanceOf(TreeCollectionSourceInterface::class, $this->tree); | ||||
|         $this->assertInstanceOf(DimensionHelperInterface::class, $this->tree); | ||||
|     } | ||||
|  | ||||
|     public function testMembers() | ||||
|     { | ||||
|         $member = new class() extends AbstractSource { | ||||
|         }; | ||||
|         $this->tree->setMembers(new ArrayCollection([ | ||||
|             $member, | ||||
|         ])); | ||||
|         $this->assertEquals($member, $this->tree->getMembers() | ||||
|             ->get(0)); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user