2018-11-04 12:40:57 +01:00
|
|
|
<?php
|
|
|
|
|
2019-01-20 10:41:58 +01:00
|
|
|
namespace Tests\Unit\Attribut;
|
2018-11-04 12:40:57 +01:00
|
|
|
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Attribut\UserAttribut;
|
2020-04-02 21:13:35 +02:00
|
|
|
use Infinito\Attribut\UserAttributInterface;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\UserInterface;
|
2020-04-02 21:13:35 +02:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2018-11-04 12:40:57 +01:00
|
|
|
|
2019-02-03 00:30:53 +01:00
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
2018-11-04 12:40:57 +01:00
|
|
|
class UserAttributTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var UserAttributInterface
|
|
|
|
*/
|
|
|
|
public $user;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->user = new class() implements UserAttributInterface {
|
|
|
|
use UserAttribut;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testConstructor(): void
|
|
|
|
{
|
2019-02-03 00:30:53 +01:00
|
|
|
$this->assertFalse($this->user->hasUser());
|
2018-11-04 12:40:57 +01:00
|
|
|
$this->expectException(\TypeError::class);
|
|
|
|
$this->user->getUser();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testAccessors(): void
|
|
|
|
{
|
|
|
|
$user = $this->createMock(UserInterface::class);
|
|
|
|
$this->assertNull($this->user->setUser($user));
|
|
|
|
$this->assertEquals($user, $this->user->getUser());
|
2019-02-03 00:30:53 +01:00
|
|
|
$this->assertTrue($this->user->hasUser());
|
2018-11-04 12:40:57 +01:00
|
|
|
}
|
|
|
|
}
|