mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-10 22:37:28 +01:00
44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Domain\User;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
|
use Infinito\Entity\User;
|
|
use Infinito\Domain\User\UserSourceDirector;
|
|
use Infinito\Repository\Source\SourceRepository;
|
|
use Infinito\Entity\Source\AbstractSource;
|
|
use Infinito\Domain\Fixture\FixtureSource\GuestUserFixtureSource;
|
|
|
|
/**
|
|
* @author kevinfrantz
|
|
*/
|
|
class UserSourceDirectorTest extends KernelTestCase
|
|
{
|
|
/**
|
|
* @var SourceRepository
|
|
*/
|
|
private $sourceRepository;
|
|
|
|
public function setUp(): void
|
|
{
|
|
self::bootKernel();
|
|
$this->sourceRepository = self::$container->get('doctrine.orm.default_entity_manager')->getRepository(AbstractSource::class);
|
|
}
|
|
|
|
public function testGuestUser(): void
|
|
{
|
|
$origineUser = null;
|
|
$userIdentityManager = new UserSourceDirector($this->sourceRepository, $origineUser);
|
|
$expectedUser = $userIdentityManager->getUser();
|
|
$this->assertEquals(GuestUserFixtureSource::getSlug(), $expectedUser->getSource()->getSlug());
|
|
}
|
|
|
|
public function testUser(): void
|
|
{
|
|
$origineUser = $this->createMock(User::class);
|
|
$userIdentityManager = new UserSourceDirector($this->sourceRepository, $origineUser);
|
|
$expectedUser = $userIdentityManager->getUser();
|
|
$this->assertEquals($origineUser, $expectedUser);
|
|
}
|
|
}
|