General optimation of tests and namespaces

This commit is contained in:
Kevin Frantz
2018-10-31 19:15:07 +01:00
parent a798262150
commit d427eeb458
15 changed files with 57 additions and 24 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace tests\unit\Entity;
use PHPUnit\Framework\TestCase;
use App\Entity\EntityInterface;
use App\Entity\AbstractEntity;
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());
}
}