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

37 lines
810 B
PHP
Raw Normal View History

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
use PHPUnit\Framework\TestCase;
2019-01-20 10:41:58 +01:00
use App\Attribut\UserAttributInterface;
use App\Attribut\UserAttribut;
2018-11-04 12:40:57 +01:00
use App\Entity\UserInterface;
class UserAttributTest extends TestCase
{
/**
* @var UserAttributInterface
*/
public $user;
public function setUp(): void
{
$this->user = new class() implements UserAttributInterface {
use UserAttribut;
};
}
public function testConstructor(): void
{
$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());
}
}