2018-10-31 14:10:20 +01:00
|
|
|
<?php
|
|
|
|
|
2018-10-31 16:15:39 +01:00
|
|
|
namespace tests\unit\Entity;
|
2018-10-31 14:10:20 +01:00
|
|
|
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\AbstractEntity;
|
2020-04-02 21:13:35 +02:00
|
|
|
use Infinito\Entity\EntityInterface;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2018-10-31 14:10:20 +01:00
|
|
|
|
|
|
|
class AbstractEntityTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var EntityInterface
|
|
|
|
*/
|
|
|
|
protected $entity;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->entity = new class() extends AbstractEntity {
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testConstructor(): void
|
|
|
|
{
|
2018-11-17 14:48:48 +01:00
|
|
|
$this->assertEquals(0, $this->entity->getVersion());
|
2019-02-13 18:03:25 +01:00
|
|
|
$this->assertNull($this->entity->getId());
|
2018-10-31 14:10:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
}
|