Implemented test for Entity

This commit is contained in:
Kevin Frantz committed 2018-10-31 14:10:20 +01:00
1 parent 38539aa9ed
commit 342a07ee28
3 files changed
+40 -2

No files matched your search

@@ -31,6 +31,5 @@ abstract class AbstractEntity implements EntityInterface
public function __construct()
{
// $this->id = 0;
}
}
-1
View File
@@ -81,6 +81,5 @@ final class Relation extends AbstractMeta implements RelationInterface
$this->law = new Law();
$this->parents = new ArrayCollection();
$this->childs = new ArrayCollection();
//$this->law->setNode($this);
}
}
@@ -0,0 +1,40 @@
<?php
namespace App\Entity;
use PHPUnit\Framework\TestCase;
class AbstractEntityTest extends TestCase
{
/**
* @var EntityInterface
*/
protected $entity;
public function setUp(): void
{
$this->entity = new class() extends AbstractEntity {
};
}
public function testConstructor(): void
{
$this->expectException(\TypeError::class);
$this->entity->getId();
$this->entity->getVersion();
}
public function testVersion(): void
{
$version = 123;
$this->assertNull($this->entity->setVersion($version));
$this->assertEquals($version, $this->entity->getVersion());
}
public function testId(): void
{
$id = 123;
$this->assertNull($this->entity->setId($id));
$this->assertEquals($id, $this->entity->getId());
}
}