2018-11-04 12:12:34 +01:00
|
|
|
<?php
|
2018-11-04 12:25:53 +01:00
|
|
|
|
2019-01-20 10:41:58 +01:00
|
|
|
namespace App\Attribut;
|
2018-11-04 12:12:34 +01:00
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class NameAttributTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var NameAttributInterface
|
|
|
|
*/
|
|
|
|
public $name;
|
2018-11-04 12:25:53 +01:00
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->name = new class() implements NameAttributInterface {
|
2018-11-04 12:12:34 +01:00
|
|
|
use NameAttribut;
|
|
|
|
};
|
|
|
|
}
|
2018-11-04 12:25:53 +01:00
|
|
|
|
|
|
|
public function testConstructor(): void
|
|
|
|
{
|
2018-11-04 12:12:34 +01:00
|
|
|
$this->expectException(\TypeError::class);
|
|
|
|
$this->name->getName();
|
|
|
|
}
|
2018-11-04 12:25:53 +01:00
|
|
|
|
|
|
|
public function testAccessors(): void
|
|
|
|
{
|
|
|
|
$name = 'hello world!';
|
2018-11-04 12:12:34 +01:00
|
|
|
$this->assertNull($this->name->setName($name));
|
|
|
|
$this->assertEquals($name, $this->name->getName());
|
|
|
|
}
|
|
|
|
}
|