update to Symfony 4.4 (#1275)

This commit is contained in:
Kevin Papst
2020-02-04 15:29:26 +01:00
committed by GitHub
parent 375691365e
commit 75dcae6fbe
53 changed files with 1046 additions and 1019 deletions

View File

@@ -15,18 +15,23 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\ORM\EntityManager;
use Symfony\Bundle\FrameworkBundle\Client;
/**
* A trait to be used in all tests that extend the KernelTestCase.
*/
trait KernelTestTrait
{
/**
* @param EntityManager $em
* @param Fixture $fixture
*/
protected function importFixture(EntityManager $em, Fixture $fixture)
protected function importFixture($client, Fixture $fixture)
{
if ($client instanceof Client) {
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
} elseif ($client instanceof EntityManager) {
$em = $client;
} else {
throw new \InvalidArgumentException('Fixtures need an EntityManager to be imported');
}
$loader = new Loader();
$loader->addFixture($fixture);