Implemented childs attribute test and code formating

This commit is contained in:
Kevin Frantz 2018-11-04 13:14:11 +01:00
parent 2e9b33c82b
commit d20b3f2504
2 changed files with 43 additions and 6 deletions

View File

@ -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());
}
}

View File

@ -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();
}
}