2019-01-13 20:43:33 +01:00
|
|
|
<?php
|
|
|
|
|
2019-05-30 17:15:50 +02:00
|
|
|
namespace tests\Unit\Domain\User;
|
2019-01-13 20:43:33 +01:00
|
|
|
|
2019-05-30 17:15:50 +02:00
|
|
|
use Infinito\Domain\User\UserSourceDirectorInterface;
|
|
|
|
use Infinito\Domain\User\UserSourceDirectorService;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\Source\SourceInterface;
|
2020-04-02 21:13:35 +02:00
|
|
|
use Infinito\Entity\User;
|
2019-01-13 20:43:33 +01:00
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
|
|
|
use Symfony\Component\Security\Core\Security;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
|
|
|
class UserSourceDirectorServiceTest extends KernelTestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var UserSourceDirectorInterface
|
|
|
|
*/
|
|
|
|
private $userSourceDirectorService;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
self::bootKernel();
|
|
|
|
$container = self::$container;
|
|
|
|
$security = new Security($container);
|
|
|
|
$entityManager = $container->get('doctrine.orm.default_entity_manager');
|
|
|
|
$this->userSourceDirectorService = new UserSourceDirectorService($entityManager, $security);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGuestUser(): void
|
|
|
|
{
|
|
|
|
$user = $this->userSourceDirectorService->getUser();
|
|
|
|
$this->assertInstanceOf(User::class, $user);
|
|
|
|
$this->assertInstanceOf(SourceInterface::class, $user->getSource());
|
|
|
|
}
|
|
|
|
}
|