infinito/application/tests/Unit/Entity/Attribut/NameAttributTest.php

34 lines
684 B
PHP
Raw Normal View History

2018-11-04 12:12:34 +01:00
<?php
2018-11-04 12:25:53 +01:00
2018-11-04 12:12:34 +01:00
namespace App\Entity\Attribut;
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());
}
}