Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function generate(LoaderInterface $loader, FixturesLoaderInterface $fixturesLoader, array $bundles, $environment)
 {
     $doctrineDataLoaders = $this->fixturesFinder->getDataLoaders($bundles, $environment);
     $_fixturesLoader = clone $fixturesLoader;
     $_fixturesLoader->addProvider($doctrineDataLoaders);
     return new Loader($_fixturesLoader, $loader->getProcessors(), $loader->getPersistOnce());
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function generate(LoaderInterface $loader, FixturesLoaderInterface $fixturesLoader, array $bundles, $environment)
 {
     if (!$loader instanceof Loader) {
         throw new \UnexpectedValueException('Unsupported loader for this generator. Must be an instance of Hautelook\\AliceBundle\\Alice\\DataFixtures\\Loader.');
     }
     $doctrineDataLoaders = $this->fixturesFinder->getDataLoaders($bundles, $environment);
     $_fixturesLoader = clone $fixturesLoader;
     $_fixturesLoader->addProvider($doctrineDataLoaders);
     return new Loader($_fixturesLoader, $loader->getProcessorChain(), $loader->getPersistOnce(), $loader->getLoadingLimit());
 }
 /**
  * @cover ::getDataLoaders
  * @dataProvider dataLoadersProvider
  */
 public function testGetDataLoaders($bundles, $environment, $expected)
 {
     $finder = new FixturesFinder('DataFixtures/ORM');
     $loaders = $finder->getDataLoaders($bundles, $environment);
     try {
         foreach ($loaders as $index => $loader) {
             $loaders[$index] = get_class($loader);
         }
         $this->assertCount(0, array_diff($expected, $loaders));
     } catch (\InvalidArgumentException $exception) {
         if (0 !== count($expected)) {
             throw $exception;
         }
     }
 }