infinito/application/symfony/tests/Integration/DataFixtures/SourceFixturesIntegrationTest.php

39 lines
1.3 KiB
PHP
Raw Normal View History

2018-11-23 22:09:29 +01:00
<?php
namespace Tests\Integration\DataFixtures;
2018-11-23 22:09:29 +01:00
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Doctrine\ORM\EntityManager;
use App\Entity\Source\AbstractSource;
use App\Entity\Source\Complex\UserSourceInterface;
2019-02-02 23:02:28 +01:00
use App\Domain\FixtureManagement\FixtureSource\ImpressumFixtureSource;
use App\Domain\FixtureManagement\FixtureSource\GuestUserFixtureSource;
2018-11-23 22:09:29 +01:00
class SourceFixturesIntegrationTest extends KernelTestCase
2018-11-23 22:09:29 +01:00
{
/**
* @var EntityManager
*/
protected $entityManager;
public function setUp(): void
{
self::bootKernel();
$this->entityManager = static::$kernel->getContainer()->get('doctrine')->getManager();
}
public function testImpressumSource(): void
2018-11-23 22:09:29 +01:00
{
$sourceRepository = $this->entityManager->getRepository(AbstractSource::class);
2019-02-02 23:02:28 +01:00
$imprint = $sourceRepository->findOneBySlug(ImpressumFixtureSource::SLUG);
2018-11-23 22:09:29 +01:00
$this->assertInternalType('string', $imprint->getText());
}
public function testGuestUserSource(): void
{
$sourceRepository = $this->entityManager->getRepository(AbstractSource::class);
2019-02-02 23:02:28 +01:00
$userSource = $sourceRepository->findOneBySlug(GuestUserFixtureSource::SLUG);
$this->assertInstanceOf(UserSourceInterface::class, $userSource);
}
2018-11-23 22:09:29 +01:00
}