2018-11-01 20:42:18 +01:00
|
|
|
<?php
|
2018-11-01 22:34:26 +01:00
|
|
|
|
2018-11-01 20:42:18 +01:00
|
|
|
namespace Tests\Unit\Entity\Attribut;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use App\Entity\Attribut\IdAttribut;
|
|
|
|
use App\Entity\Attribut\IdAttributInterface;
|
|
|
|
|
|
|
|
class IdAttributTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var IdAttributInterface
|
|
|
|
*/
|
|
|
|
protected $id;
|
2018-11-01 22:34:26 +01:00
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->id = new class() implements IdAttributInterface {
|
2018-11-01 20:42:18 +01:00
|
|
|
use IdAttribut;
|
|
|
|
};
|
|
|
|
}
|
2018-11-01 22:34:26 +01:00
|
|
|
|
|
|
|
public function testConstruct(): void
|
|
|
|
{
|
2018-11-01 20:42:18 +01:00
|
|
|
$this->expectException(\TypeError::class);
|
|
|
|
$this->id->getId();
|
|
|
|
}
|
2018-11-01 22:34:26 +01:00
|
|
|
|
|
|
|
public function testAccessors(): void
|
|
|
|
{
|
2018-11-01 20:42:18 +01:00
|
|
|
$id = 1234;
|
|
|
|
$this->assertNull($this->id->setId($id));
|
|
|
|
$this->assertEquals($id, $this->id->getId());
|
|
|
|
}
|
|
|
|
}
|