mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 05:47:11 +02:00
Refactored\moved Attribut folder
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Exception\NoValidChoiceException;
|
||||
use App\Attribut\ActionTypeAttributInterface;
|
||||
use App\Attribut\ActionTypeAttribut;
|
||||
use App\DBAL\Types\ActionType;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class ActionTypeAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ActionTypeAttributInterface
|
||||
*/
|
||||
protected $actionTypeAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->actionTypeAttribut = new class() implements ActionTypeAttributInterface {
|
||||
use ActionTypeAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->actionTypeAttribut->getActionType();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
foreach (ActionType::getChoices() as $enum) {
|
||||
$this->assertNull($this->actionTypeAttribut->setActionType($enum));
|
||||
$this->assertEquals($enum, $this->actionTypeAttribut->getActionType());
|
||||
}
|
||||
$this->expectException(NoValidChoiceException::class);
|
||||
$this->actionTypeAttribut->setActionType('NoneValidType');
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\ChildsAttributeInterface;
|
||||
use App\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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\CollectionAttributInterface;
|
||||
use App\Attribut\CollectionAttribut;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
class CollectionAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var CollectionAttributInterface
|
||||
*/
|
||||
protected $collection;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->collection = new class() implements CollectionAttributInterface {
|
||||
use CollectionAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->collection->getCollection();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$collection = new ArrayCollection();
|
||||
$this->assertNull($this->collection->setCollection($collection));
|
||||
$this->assertEquals($collection, $this->collection->getCollection());
|
||||
}
|
||||
|
||||
public function testAdd(): void
|
||||
{
|
||||
$mock = new class() {
|
||||
};
|
||||
$this->collection->setCollection(new ArrayCollection());
|
||||
$this->assertTrue($this->collection->getCollection()->add($mock));
|
||||
$this->assertEquals($mock, $this->collection->getCollection()->get(0));
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\ConditionAttributInterface;
|
||||
use App\Attribut\ConditionAttribut;
|
||||
use App\Logic\Operation\OperationInterface;
|
||||
|
||||
class ConditionAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ConditionAttributInterface
|
||||
*/
|
||||
protected $condition;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->condition = new class() implements ConditionAttributInterface {
|
||||
use ConditionAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->condition->getCondition();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$this->assertEquals(false, $this->condition->hasCondition());
|
||||
$condition = $this->createMock(OperationInterface::class);
|
||||
$this->assertNull($this->condition->setCondition($condition));
|
||||
$this->assertEquals(true, $this->condition->hasCondition());
|
||||
$this->assertEquals($condition, $this->condition->getCondition());
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\CreatorRelationAttributInterface;
|
||||
use App\Attribut\CreatorRelationAttribut;
|
||||
use App\Entity\Meta\Relation\Parent\CreatorRelationInterface;
|
||||
|
||||
class CreatorRelationAttributTest extends TestCase
|
||||
{
|
||||
/***
|
||||
* @var CreatorRelationAttributInterface
|
||||
*/
|
||||
protected $creatorRelationAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->creatorRelationAttribut = new class() implements CreatorRelationAttributInterface {
|
||||
use CreatorRelationAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$relation = $this->createMock(CreatorRelationInterface::class);
|
||||
$this->assertNull($this->creatorRelationAttribut->setCreatorRelation($relation));
|
||||
$this->assertEquals($relation, $this->creatorRelationAttribut->getCreatorRelation());
|
||||
}
|
||||
}
|
43
application/symfony/tests/Unit/Attribut/CrudAttributTest.php
Normal file
43
application/symfony/tests/Unit/Attribut/CrudAttributTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\CrudAttributInterface;
|
||||
use App\Attribut\CrudAttribut;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
use App\Exception\NoValidChoiceException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class CrudAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var CrudAttributInterface
|
||||
*/
|
||||
protected $crudAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->crudAttribut = new class() implements CrudAttributInterface {
|
||||
use CrudAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->crudAttribut->getCrud();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
foreach (CRUDType::getChoices() as $enum) {
|
||||
$this->assertNull($this->crudAttribut->setCrud($enum));
|
||||
$this->assertEquals($enum, $this->crudAttribut->getCrud());
|
||||
}
|
||||
$this->expectException(NoValidChoiceException::class);
|
||||
$this->crudAttribut->setCrud('NoneValidType');
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\FirstNameSourceAttribut;
|
||||
use App\Attribut\FirstNameSourceAttributInterface;
|
||||
use App\Entity\Source\Primitive\Name\FirstNameSourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class FirstNameSourceAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var FirstNameSourceAttributInterface
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->name = new class() implements FirstNameSourceAttributInterface {
|
||||
use FirstNameSourceAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->name->getFirstNameSource();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$name = $this->createMock(FirstNameSourceInterface::class);
|
||||
$this->assertNull($this->name->setFirstNameSource($name));
|
||||
$this->assertEquals($name, $this->name->getFirstNameSource());
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\Source\Complex\FullPersonNameSourceInterface;
|
||||
use App\Attribut\FullPersonNameSourceAttributInterface;
|
||||
use App\Attribut\FullPersonNameSourceAttribut;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class FullPersonNameSourceAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var FullPersonNameSourceAttributInterface
|
||||
*/
|
||||
protected $fullname;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->fullname = new class() implements FullPersonNameSourceAttributInterface {
|
||||
use FullPersonNameSourceAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->fullname->getFullPersonNameSource();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$fullname = $this->createMock(FullPersonNameSourceInterface::class);
|
||||
$this->assertNull($this->fullname->setFullPersonNameSource($fullname));
|
||||
$this->assertEquals($fullname, $this->fullname->getFullPersonNameSource());
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\GrantAttribut;
|
||||
use App\Attribut\GrantAttributInterface;
|
||||
|
||||
class GrantAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var GrantAttributInterface
|
||||
*/
|
||||
protected $grant;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->grant = new class() implements GrantAttributInterface {
|
||||
use GrantAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->grant->getGrant();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$grant = true;
|
||||
$this->assertNull($this->grant->setGrant($grant));
|
||||
$this->assertEquals($grant, $this->grant->getGrant());
|
||||
}
|
||||
}
|
42
application/symfony/tests/Unit/Attribut/IdAttributTest.php
Normal file
42
application/symfony/tests/Unit/Attribut/IdAttributTest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\IdAttribut;
|
||||
use App\Attribut\IdAttributInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class IdAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var IdAttributInterface
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->id = new class() implements IdAttributInterface {
|
||||
use IdAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$this->assertFalse($this->id->hasId());
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->id->getId();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$id = 1234;
|
||||
$this->assertNull($this->id->setId($id));
|
||||
$this->assertEquals($id, $this->id->getId());
|
||||
$this->assertTrue($this->id->hasId());
|
||||
$this->assertNull($this->id->setId(0));
|
||||
$this->assertTrue($this->id->hasId());
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\LayerAttributInterface;
|
||||
use App\Attribut\LayerAttribut;
|
||||
use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\Exception\NoValidChoiceException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class LayerAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var LayerAttributInterface
|
||||
*/
|
||||
protected $layerAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->layerAttribut = new class() implements LayerAttributInterface {
|
||||
use LayerAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->layerAttribut->getLayer();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
foreach (LayerType::getChoices() as $enum) {
|
||||
$this->assertNull($this->layerAttribut->setLayer($enum));
|
||||
$this->assertEquals($enum, $this->layerAttribut->getLayer());
|
||||
}
|
||||
$this->expectException(NoValidChoiceException::class);
|
||||
$this->layerAttribut->setLayer('NoneValidLayer');
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\MemberRelationAttributInterface;
|
||||
use App\Attribut\MemberRelationAttribut;
|
||||
use App\Entity\Meta\Relation\Member\MemberRelationInterface;
|
||||
|
||||
class MemberRelationAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var MemberRelationAttributInterface
|
||||
*/
|
||||
protected $memberRelation;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->memberRelation = new class() implements MemberRelationAttributInterface {
|
||||
use MemberRelationAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->memberRelation->getMemberRelation();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$membership = $this->createMock(MemberRelationInterface::class);
|
||||
$this->assertNull($this->memberRelation->setMemberRelation($membership));
|
||||
$this->assertEquals($this->memberRelation->getMemberRelation(), $membership);
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Attribut\MembersAttributInterface;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
use App\Attribut\MembersAttribut;
|
||||
|
||||
class MembersAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var MembersAttributInterface
|
||||
*/
|
||||
protected $members;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->members = new class() implements MembersAttributInterface {
|
||||
use MembersAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->members->getMembers();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$membership = $this->createMock(SourceInterface::class);
|
||||
$this->assertNull($this->members->setMembers(new ArrayCollection([$membership])));
|
||||
$this->assertEquals($this->members->getMembers()->get(0), $membership);
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\MembershipsAttributInterface;
|
||||
use App\Attribut\MembershipsAttribut;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Source\Complex\Collection\TreeCollectionSourceInterface;
|
||||
|
||||
class MembershipsAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var MembershipsAttributInterface
|
||||
*/
|
||||
protected $memberships;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->memberships = new class() implements MembershipsAttributInterface {
|
||||
use MembershipsAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->memberships->getMemberships();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$membership = $this->createMock(TreeCollectionSourceInterface::class);
|
||||
$this->assertNull($this->memberships->setMemberships(new ArrayCollection([$membership])));
|
||||
$this->assertEquals($this->memberships->getMemberships()->get(0), $membership);
|
||||
}
|
||||
}
|
33
application/symfony/tests/Unit/Attribut/NameAttributTest.php
Normal file
33
application/symfony/tests/Unit/Attribut/NameAttributTest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class NameAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var NameAttributInterface
|
||||
*/
|
||||
public $name;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->name = new class() implements NameAttributInterface {
|
||||
use NameAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->name->getName();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$name = 'hello world!';
|
||||
$this->assertNull($this->name->setName($name));
|
||||
$this->assertEquals($name, $this->name->getName());
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace tests\unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\NameSourceAttributInterface;
|
||||
use App\Attribut\NameSourceAttribut;
|
||||
use App\Entity\Source\Primitive\Name\NameSourceInterface;
|
||||
|
||||
class NameSourceAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var NameSourceAttributInterface
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->name = new class() implements NameSourceAttributInterface {
|
||||
use NameSourceAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->name->getNameSource();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$nameSource = $this->createMock(NameSourceInterface::class);
|
||||
$this->assertNull($this->name->setNameSource($nameSource));
|
||||
$this->assertEquals($nameSource, $this->name->getNameSource());
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\ParentRelationAttributInterface;
|
||||
use App\Attribut\ParentRelationAttribut;
|
||||
use App\Entity\Meta\Relation\Parent\ParentRelationInterface;
|
||||
|
||||
class ParentRelationAttributTest extends TestCase
|
||||
{
|
||||
/***
|
||||
* @var ParentRelationAttributInterface
|
||||
*/
|
||||
protected $parentRelationAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->parentRelationAttribut = new class() implements ParentRelationAttributInterface {
|
||||
use ParentRelationAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$relation = $this->createMock(ParentRelationInterface::class);
|
||||
$this->assertNull($this->parentRelationAttribut->setParentRelation($relation));
|
||||
$this->assertEquals($relation, $this->parentRelationAttribut->getParentRelation());
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\ParentsAttributInterface;
|
||||
use App\Attribut\ParentsAttribut;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
class ParentsAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ParentsAttributInterface
|
||||
*/
|
||||
protected $parents;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->parents = new class() implements ParentsAttributInterface {
|
||||
use ParentsAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->parents->getParents();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$parents = new ArrayCollection();
|
||||
$this->assertNull($this->parents->setParents($parents));
|
||||
$this->assertEquals($parents, $this->parents->getParents());
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\PersonIdentitySourceAttributInterface;
|
||||
use App\Attribut\PersonIdentitySourceAttribut;
|
||||
use App\Entity\Source\Complex\PersonIdentitySourceInterface;
|
||||
|
||||
/**
|
||||
* @todo Implement abstract test class for entity attributs
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class PersonIdentitySourceAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var PersonIdentitySourceAttributInterface
|
||||
*/
|
||||
protected $identity;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->identity = new class() implements PersonIdentitySourceAttributInterface {
|
||||
use PersonIdentitySourceAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->identity->getPersonIdentitySource();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$identity = $this->createMock(PersonIdentitySourceInterface::class);
|
||||
$this->assertNull($this->identity->setPersonIdentitySource($identity));
|
||||
$this->assertEquals($identity, $this->identity->getPersonIdentitySource());
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\PriorityAttributInterface;
|
||||
use App\Attribut\PriorityAttribut;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class PriorityAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var PriorityAttributInterface
|
||||
*/
|
||||
protected $priorityAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->priorityAttribut = new class() implements PriorityAttributInterface {
|
||||
use PriorityAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->priorityAttribut->getPriority();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$priority = 123;
|
||||
$this->assertNull($this->priorityAttribut->setPriority($priority));
|
||||
$this->assertEquals($priority, $this->priorityAttribut->getPriority());
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\RecieverAttributInterface;
|
||||
use App\Attribut\RecieverAttribut;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
|
||||
class RecieverAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var RecieverAttributInterface
|
||||
*/
|
||||
protected $reciever;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->reciever = new class() implements RecieverAttributInterface {
|
||||
use RecieverAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->reciever->getReciever();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$reciever = $this->createMock(AbstractSource::class);
|
||||
$this->assertNull($this->reciever->setReciever($reciever));
|
||||
$this->assertEquals($reciever, $this->reciever->getReciever());
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Entity\Meta\Relation\RelationInterface;
|
||||
use App\Attribut\RelationAttributInterface;
|
||||
use App\Attribut\RelationAttribut;
|
||||
|
||||
class RelationAttributTest extends TestCase
|
||||
{
|
||||
/***
|
||||
* @var RelationAttributInterface
|
||||
*/
|
||||
protected $relationAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->relationAttribut = new class() implements RelationAttributInterface {
|
||||
use RelationAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$relation = $this->createMock(RelationInterface::class);
|
||||
$this->assertNull($this->relationAttribut->setRelation($relation));
|
||||
$this->assertEquals($relation, $this->relationAttribut->getRelation());
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\RightAttributInterface;
|
||||
use App\Attribut\RightAttribut;
|
||||
use App\Entity\Meta\RightInterface;
|
||||
|
||||
class RightAttributTest extends TestCase
|
||||
{
|
||||
/***
|
||||
* @var RightAttributInterface
|
||||
*/
|
||||
private $rightAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->rightAttribut = new class() implements RightAttributInterface {
|
||||
use RightAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$right = $this->createMock(RightInterface::class);
|
||||
$this->assertNull($this->rightAttribut->setRight($right));
|
||||
$this->assertEquals($right, $this->rightAttribut->getRight());
|
||||
}
|
||||
}
|
42
application/symfony/tests/Unit/Attribut/SlugAttributTest.php
Normal file
42
application/symfony/tests/Unit/Attribut/SlugAttributTest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\SlugAttributInterface;
|
||||
use App\Attribut\SlugAttribut;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class SlugAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var SlugAttributInterface
|
||||
*/
|
||||
protected $slugAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->slugAttribut = new class() implements SlugAttributInterface {
|
||||
use SlugAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->assertFalse($this->slugAttribut->hasSlug());
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->slugAttribut->getSlug();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$slug = 'goodslug';
|
||||
$this->assertNull($this->slugAttribut->setSlug($slug));
|
||||
$this->assertTrue($this->slugAttribut->hasSlug());
|
||||
$this->assertEquals($slug, $this->slugAttribut->getSlug());
|
||||
$this->assertNull($this->slugAttribut->setSlug(''));
|
||||
$this->assertTrue($this->slugAttribut->hasSlug());
|
||||
}
|
||||
}
|
38
application/symfony/tests/Unit/Attribut/TextAttributTest.php
Normal file
38
application/symfony/tests/Unit/Attribut/TextAttributTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\TextAttributInterface;
|
||||
use App\Attribut\TextAttribut;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class TextAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var TextAttributInterface
|
||||
*/
|
||||
protected $textAttribut;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->textAttribut = new class() implements TextAttributInterface {
|
||||
use TextAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->textAttribut->getText();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$text = 'Hello World!';
|
||||
$this->assertNull($this->textAttribut->setText($text));
|
||||
$this->assertEquals($text, $this->textAttribut->getText());
|
||||
}
|
||||
}
|
36
application/symfony/tests/Unit/Attribut/UserAttributTest.php
Normal file
36
application/symfony/tests/Unit/Attribut/UserAttributTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Attribut;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use App\Attribut\UserAttributInterface;
|
||||
use App\Attribut\UserAttribut;
|
||||
use App\Entity\UserInterface;
|
||||
|
||||
class UserAttributTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var UserAttributInterface
|
||||
*/
|
||||
public $user;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->user = new class() implements UserAttributInterface {
|
||||
use UserAttribut;
|
||||
};
|
||||
}
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->user->getUser();
|
||||
}
|
||||
|
||||
public function testAccessors(): void
|
||||
{
|
||||
$user = $this->createMock(UserInterface::class);
|
||||
$this->assertNull($this->user->setUser($user));
|
||||
$this->assertEquals($user, $this->user->getUser());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user