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
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2018-10-31 16:15:39 +01:00
|
|
|
use App\Entity\EntityInterface;
|
|
|
|
use App\Entity\AbstractEntity;
|
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
|
|
|
|
{
|
|
|
|
$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());
|
|
|
|
}
|
2018-10-31 22:25:01 +01:00
|
|
|
|
|
|
|
public function testToString(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals(true, is_string($this->entity->__toString()));
|
|
|
|
}
|
2018-10-31 14:10:20 +01:00
|
|
|
}
|