mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Implemented test for Entity
This commit is contained in:
40
application/tests/unit/Entity/AbstractEntityTest.php
Normal file
40
application/tests/unit/Entity/AbstractEntityTest.php
Normal file
@@ -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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user