2018-11-04 12:24:52 +01:00
|
|
|
<?php
|
2018-11-04 12:25:53 +01:00
|
|
|
|
2018-11-21 17:55:48 +01:00
|
|
|
namespace tests\unit\Entity\Source\Complex;
|
2018-11-04 12:24:52 +01:00
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2018-11-21 17:55:48 +01:00
|
|
|
use App\Entity\Source\Complex\UserSourceInterface;
|
|
|
|
use App\Entity\Source\Complex\UserSource;
|
2018-11-04 12:24:52 +01:00
|
|
|
use Doctrine\Common\Collections\Collection;
|
2018-11-21 17:55:48 +01:00
|
|
|
use App\Entity\Source\Complex\PersonIdentitySourceInterface;
|
2018-11-04 12:24:52 +01:00
|
|
|
|
|
|
|
class UserSourceTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var UserSourceInterface
|
|
|
|
*/
|
|
|
|
public $userSource;
|
2018-11-04 12:25:53 +01:00
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
2018-11-04 12:24:52 +01:00
|
|
|
$this->userSource = new UserSource();
|
|
|
|
}
|
2018-11-04 12:25:53 +01:00
|
|
|
|
|
|
|
public function testConstructor(): void
|
|
|
|
{
|
2018-11-04 12:24:52 +01:00
|
|
|
$this->assertInstanceOf(Collection::class, $this->userSource->getMemberships());
|
2018-11-22 21:54:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testHasPersonIdentitySource(): void
|
|
|
|
{
|
|
|
|
$this->assertFalse($this->userSource->hasPersonIdentitySource());
|
|
|
|
$this->userSource->setPersonIdentitySource($this->createMock(PersonIdentitySourceInterface::class));
|
|
|
|
$this->assertTrue($this->userSource->hasPersonIdentitySource());
|
2018-11-15 20:30:34 +01:00
|
|
|
$this->assertInstanceOf(PersonIdentitySourceInterface::class, $this->userSource->getPersonIdentitySource());
|
2018-11-22 21:54:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testInitPersonIdentitySource(): void
|
|
|
|
{
|
|
|
|
$this->expectException(\TypeError::class);
|
|
|
|
$this->userSource->getPersonIdentitySource();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testInitUser(): void
|
|
|
|
{
|
2018-11-04 12:40:57 +01:00
|
|
|
$this->expectException(\TypeError::class);
|
|
|
|
$this->userSource->getUser();
|
2018-11-04 12:24:52 +01:00
|
|
|
}
|
|
|
|
}
|