/**
  * Loads multiple fixture files
  *
  * @param ObjectManager       $objectManager
  * @param ReferenceRepository $referenceRepository
  * @param array               $paths
  *
  * @throws FixtureLoaderException
  */
 public function load(ObjectManager $objectManager, ReferenceRepository $referenceRepository, array $paths)
 {
     foreach ($this->registry->getFixtures($paths) as $fixtureConfig) {
         $loader = $this->factory->create($objectManager, $referenceRepository, $fixtureConfig['name'], $fixtureConfig['extension']);
         try {
             $loader->load($fixtureConfig['path']);
         } catch (InvalidItemException $ex) {
             throw new FixtureLoaderException($fixtureConfig, $ex);
         }
     }
 }
 public function testCreate()
 {
     $doctrineCache = $this->getMockBuilder('Pim\\Bundle\\TransformBundle\\Cache\\DoctrineCache')->disableOriginalConstructor()->getMock();
     $configurationRegistry = $this->getMock('Pim\\Bundle\\InstallerBundle\\FixtureLoader\\ConfigurationRegistryInterface');
     $objectManager = $this->getMock('Doctrine\\Common\\Persistence\\ObjectManager');
     $referenceRepository = $this->getMockBuilder('Doctrine\\Common\\DataFixtures\\ReferenceRepository')->disableOriginalConstructor()->getMock();
     $doctrineCache->expects($this->once())->method('setReferenceRepository')->with($this->identicalTo($referenceRepository));
     $reader = $this->getMock('Akeneo\\Component\\Batch\\Item\\ItemReaderInterface');
     $configurationRegistry->expects($this->once())->method('getReader')->with($this->equalTo('name'), $this->equalTo('extension'))->will($this->returnValue($reader));
     $processor = $this->getMock('Akeneo\\Component\\Batch\\Item\\ItemProcessorInterface');
     $configurationRegistry->expects($this->once())->method('getProcessor')->with($this->equalTo('name'), $this->equalTo('extension'))->will($this->returnValue($processor));
     $configurationRegistry->expects($this->once())->method('getClass')->with($this->equalTo('name'))->will($this->returnValue('Pim\\Bundle\\InstallerBundle\\FixtureLoader\\Loader'));
     $eventSubscriber = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $factory = new LoaderFactory($doctrineCache, $configurationRegistry, $eventSubscriber);
     $result = $factory->create($objectManager, $referenceRepository, 'name', 'extension');
     $this->assertInstanceOf('Pim\\Bundle\\InstallerBundle\\FixtureLoader\\Loader', $result);
 }