mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Implemented tests for GroupSource
This commit is contained in:
parent
157fe99469
commit
6e058e61b5
@ -5,6 +5,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use App\Entity\Source\Attribut\MembersAttributInterface;
|
use App\Entity\Source\Attribut\MembersAttributInterface;
|
||||||
use App\Entity\Source\Attribut\MembersAttribut;
|
use App\Entity\Source\Attribut\MembersAttribut;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -22,5 +23,10 @@ final class GroupSource extends AbstractSource implements MembersAttributInterfa
|
|||||||
* @ORM\ManyToMany(targetEntity="AbstractSource")
|
* @ORM\ManyToMany(targetEntity="AbstractSource")
|
||||||
*/
|
*/
|
||||||
protected $members;
|
protected $members;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->members = new ArrayCollection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
35
application/tests/unit/Entity/Source/GroupSourceTest.php
Normal file
35
application/tests/unit/Entity/Source/GroupSourceTest.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
namespace tests\unit\Entity\Source;
|
||||||
|
|
||||||
|
use App\Entity\Source\GroupSourceInterface;
|
||||||
|
use App\Entity\Source\GroupSource;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use App\Entity\Source\AbstractSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class GroupSourceTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var GroupSourceInterface
|
||||||
|
*/
|
||||||
|
protected $groupSource;
|
||||||
|
|
||||||
|
public function setUp():void {
|
||||||
|
$this->groupSource = new GroupSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMembers(){
|
||||||
|
$this->assertInstanceOf(Collection::class, $this->groupSource->getMembers());
|
||||||
|
$member = new class extends AbstractSource{};
|
||||||
|
$this->groupSource->setMembers(new ArrayCollection([$member]));
|
||||||
|
$this->assertEquals($member, $this->groupSource->getMembers()->get(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user