/**
  * Before a test method is run, a template method called setUp() is invoked.
  */
 public function testProcessWithSeveralManagers()
 {
     $metadataCollectorMock = $this->getMockBuilder('ONGR\\ElasticsearchBundle\\Mapping\\MetadataCollector')->disableOriginalConstructor()->getMock();
     $metadataCollectorMock->expects($this->once())->method('getMappings')->willReturn(['product' => ['properties' => [], 'bundle' => 'AcmeBarBundle', 'class' => 'Foo', 'namespace' => 'Acme\\BarBundle\\Document\\Foo']]);
     $connections = ['default' => ['hosts' => ['127.0.0.1:9200'], 'index_name' => 'acme', 'settings' => ['refresh_interval' => -1, 'number_of_replicas' => 1]]];
     $managers = ['default' => ['connection' => 'default', 'debug' => true, 'readonly' => false, 'mappings' => ['AcmeBarBundle']]];
     $containerMock = $this->getMockBuilder('\\Symfony\\Component\\DependencyInjection\\ContainerBuilder')->disableOriginalConstructor()->getMock();
     $containerMock->expects($this->exactly(3))->method('getParameter')->with($this->anything())->will($this->returnCallback(function ($parameter) use($connections, $managers) {
         switch ($parameter) {
             case 'es.managers':
                 return $managers;
             case 'es.connections':
                 return $connections;
             default:
                 return null;
         }
     }));
     $containerMock->expects($this->once())->method('get')->with($this->anything())->will($this->returnCallback(function ($parameter) use($metadataCollectorMock) {
         switch ($parameter) {
             case 'es.metadata_collector':
                 return $metadataCollectorMock;
             default:
                 return null;
         }
     }));
     $containerMock->expects($this->exactly(2))->method('setDefinition')->withConsecutive([$this->equalTo('es.manager.default')], [$this->equalTo('es.manager.default.product')])->willReturn(null);
     $compilerPass = new MappingPass();
     $compilerPass->process($containerMock);
 }
 /**
  * Check when Manager Mapping is empty.
  */
 public function testWhenManagerMappingIsEmpty()
 {
     $expectedConnections = ['default' => ['hosts' => ['127.0.0.1:9200'], 'index_name' => 'ongr-elasticsearch-bundle-test', 'settings' => ['refresh_interval' => -1, 'number_of_replicas' => 0]]];
     $expectedManagers = ['default' => ['connection' => 'default', 'debug' => true, 'readonly' => false, 'mappings' => []]];
     $kernelBundles = [];
     $this->container->expects($this->any())->method('getParameter')->with($this->anything())->will($this->returnCallback(function ($parameters) use($expectedConnections, $expectedManagers, $kernelBundles) {
         switch ($parameters) {
             case 'es.connections':
                 return $expectedConnections;
             case 'es.managers':
                 return $expectedManagers;
             case 'kernel.bundles':
                 return $expectedManagers;
             default:
                 return null;
         }
     }));
     $compilerPass = new MappingPass();
     $compilerPass->process($this->container);
 }