/**
  *
  * @param array $connection
  * @param array $paths Array of Paths where Search Entities are found
  * @param \AppKernel $kernel
  */
 public function __construct(array $connection, array $paths = array(), \AppKernel $kernel)
 {
     $cacheProvider = 'Doctrine\\Common\\Cache\\ArrayCache';
     //Annotation metadata driver
     $config = new Configuration();
     $md = $config->newDefaultAnnotationDriver($paths);
     $config->setMetadataDriverImpl($md);
     $config->setMetadataCacheImpl(new $cacheProvider());
     $config->setEntitySerializer(new CallbackSerializer('toESDocument', 'fromESDocument'));
     $bundles = $kernel->getBundles();
     $entityNamespaces = array();
     foreach ($bundles as $bundle) {
         $nameSpace = $bundle->getNamespace();
         $name = $bundle->getName();
         $entityNamespaces[$name] = $nameSpace;
     }
     $config->setEntityNamespaces($entityNamespaces);
     $client = new \Elastica\Client(array('connections' => array($connection)));
     $this->searchManager = new SearchManager($config, new \Revinate\SearchBundle\Lib\Search\ElasticSearch\Client($client), new EventManager());
     $this->mappingManager = new MappingManager($this->searchManager, $kernel->getEnvironment());
 }
 /**
  * @expectedException \PHPUnit_Framework_Error
  */
 public function testNewDefaultAnnotationDriverWrongParameter()
 {
     $this->configuration->newDefaultAnnotationDriver(new \StdClass());
 }