/**
  * Service constructor
  *
  * @param array $repositories The repositories configuration
  * @param array $factories    The factories configuration
  */
 public function __construct($repositoriesConfiguration, FactoryConfigurationLoader $factoryLoader)
 {
     $this->repositories = function () use($repositoriesConfiguration, $factoryLoader) {
         $factories = $factoryLoader->getFactories();
         $repositories = new RepositoryCollection();
         foreach ($repositoriesConfiguration as $name => $repository) {
             $factory = $factories->get($repository['factory']);
             if (count(array_intersect(array_keys($repository['parameters']), $factory->getParameters())) != count($factory->getParameters())) {
                 throw new \InvalidArgumentException('An error occurred during repositories parsing : missing parameters');
             }
             $repositories->add(new Repository($name, $factory, (array) $repository['parameters']));
         }
         return $repositories;
     };
 }
 public function setUp()
 {
     $loader = new FactoryConfigurationLoader(array('foo' => array('class' => '\\Foo', 'parameters' => array('blob'), 'supportedOperations' => array('write')), 'bar' => array('class' => '\\Bar', 'parameters' => array('blobi'), 'supportedOperations' => array('read'))));
     $this->collection = $loader->getFactories();
 }