2018-11-23 22:09:29 +01:00
|
|
|
<?php
|
|
|
|
|
2018-12-31 21:18:03 +01:00
|
|
|
namespace Tests\Integration\DataFixtures;
|
2018-11-23 22:09:29 +01:00
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
|
|
|
use Doctrine\ORM\EntityManager;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\Source\AbstractSource;
|
|
|
|
use Infinito\Entity\Source\Complex\UserSourceInterface;
|
2019-05-30 16:10:09 +02:00
|
|
|
use Infinito\Domain\Fixture\FixtureSource\ImpressumFixtureSource;
|
|
|
|
use Infinito\Domain\Fixture\FixtureSource\GuestUserFixtureSource;
|
2018-11-23 22:09:29 +01:00
|
|
|
|
2018-12-31 21:18:03 +01:00
|
|
|
class SourceFixturesIntegrationTest extends KernelTestCase
|
2018-11-23 22:09:29 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var EntityManager
|
|
|
|
*/
|
|
|
|
protected $entityManager;
|
|
|
|
|
2019-02-12 18:04:36 +01:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*
|
|
|
|
* @see \PHPUnit\Framework\TestCase::setUp()
|
|
|
|
*/
|
2018-11-23 22:09:29 +01:00
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
self::bootKernel();
|
|
|
|
$this->entityManager = static::$kernel->getContainer()->get('doctrine')->getManager();
|
|
|
|
}
|
|
|
|
|
2018-12-31 21:18:03 +01:00
|
|
|
public function testImpressumSource(): void
|
2018-11-23 22:09:29 +01:00
|
|
|
{
|
|
|
|
$sourceRepository = $this->entityManager->getRepository(AbstractSource::class);
|
2019-03-29 23:21:52 +01:00
|
|
|
$imprint = $sourceRepository->findOneBySlug(ImpressumFixtureSource::getSlug());
|
2018-11-23 22:09:29 +01:00
|
|
|
$this->assertInternalType('string', $imprint->getText());
|
|
|
|
}
|
2018-12-31 21:18:03 +01:00
|
|
|
|
|
|
|
public function testGuestUserSource(): void
|
|
|
|
{
|
|
|
|
$sourceRepository = $this->entityManager->getRepository(AbstractSource::class);
|
2019-03-29 23:21:52 +01:00
|
|
|
$userSource = $sourceRepository->findOneBySlug(GuestUserFixtureSource::getSlug());
|
2018-12-31 21:18:03 +01:00
|
|
|
$this->assertInstanceOf(UserSourceInterface::class, $userSource);
|
|
|
|
}
|
2018-11-23 22:09:29 +01:00
|
|
|
}
|