infinito/application/symfony/tests/Unit/Attribut/IdAttributTest.php

42 lines
901 B
PHP
Raw Normal View History

<?php
2018-11-01 22:34:26 +01:00
2019-01-20 10:41:58 +01:00
namespace Tests\Unit\Attribut;
use PHPUnit\Framework\TestCase;
2019-01-20 10:41:58 +01:00
use App\Attribut\IdAttribut;
use App\Attribut\IdAttributInterface;
2019-01-13 20:18:52 +01:00
/**
* @author kevinfrantz
*/
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 {
use IdAttribut;
};
}
2018-11-01 22:34:26 +01:00
public function testConstruct(): void
{
2019-01-13 20:18:52 +01:00
$this->assertFalse($this->id->hasId());
$this->assertNull($this->id->getId());
}
2018-11-01 22:34:26 +01:00
public function testAccessors(): void
{
$id = 1234;
$this->assertNull($this->id->setId($id));
$this->assertEquals($id, $this->id->getId());
2019-01-13 20:18:52 +01:00
$this->assertTrue($this->id->hasId());
$this->assertNull($this->id->setId(0));
$this->assertTrue($this->id->hasId());
}
}