mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-10 06:27:24 +01:00
Optimized tests for AbstractEntity and UserSourceDirectoryService
This commit is contained in:
parent
67e389d2fb
commit
2b63e0e447
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace tests\Unit\Domain\UserManagement;
|
||||||
|
|
||||||
|
use App\Domain\UserManagement\UserSourceDirectorInterface;
|
||||||
|
use App\Domain\UserManagement\UserSourceDirectorService;
|
||||||
|
use App\Entity\User;
|
||||||
|
use App\Entity\Source\SourceInterface;
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
@ -39,9 +39,4 @@ class AbstractEntityTest extends TestCase
|
|||||||
$this->assertNull($this->entity->setId($id));
|
$this->assertNull($this->entity->setId($id));
|
||||||
$this->assertEquals($id, $this->entity->getId());
|
$this->assertEquals($id, $this->entity->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testToString(): void
|
|
||||||
{
|
|
||||||
$this->assertEquals(true, is_string($this->entity->__toString()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user