infinito/application/tests/Unit/Entity/Source/Primitive/Name/AbstractNameSourceTest.php

39 lines
902 B
PHP
Raw Normal View History

2018-10-28 22:43:35 +01:00
<?php
2018-10-29 19:01:00 +01:00
2018-11-21 17:57:58 +01:00
namespace tests\unit\Entity\Source\Primitive;
2018-10-28 22:43:35 +01:00
use PHPUnit\Framework\TestCase;
2018-11-21 17:16:32 +01:00
use App\Entity\Source\Primitive\Name\NameSourceInterface;
use App\Entity\Source\Primitive\Name\AbstractNameSource;
2018-10-28 22:43:35 +01:00
/**
* @author kevinfrantz
*/
2018-11-15 20:30:34 +01:00
class AbstractNameSourceTest extends TestCase
2018-10-28 22:43:35 +01:00
{
/**
* @var NameSourceInterface
*/
protected $nameSource;
public function setUp(): void
{
2018-11-15 20:30:34 +01:00
$this->nameSource = new class() extends AbstractNameSource {
};
2018-10-28 22:43:35 +01:00
}
2018-10-29 19:01:00 +01:00
2018-11-04 12:25:53 +01:00
public function testConstructor(): void
{
$this->assertInstanceOf(NameSourceInterface::class, $this->nameSource);
$this->expectException(\TypeError::class);
$this->nameSource->getName();
}
2018-11-04 12:25:53 +01:00
2018-10-29 19:01:00 +01:00
public function testName(): void
{
2018-10-28 22:43:35 +01:00
$name = 'Hello World!';
$this->nameSource->setName($name);
$this->assertEquals($name, $this->nameSource->getName());
}
}