public function testThatCanInsertManyObjects()
 {
     $modelTransformer = new ModelToElasticaAutoTransformer();
     $typeMock = $this->getMockBuilder('Elastica_Type')->disableOriginalConstructor()->getMock();
     $typeMock->expects($this->never())->method('deleteById');
     $typeMock->expects($this->never())->method('addDocument');
     $typeMock->expects($this->once())->method('addDocuments');
     $fields = array('name');
     $objectPersister = new ObjectPersister($typeMock, $modelTransformer, 'SomeClass', $fields);
     $objectPersister->insertMany(array(new POPO(), new POPO()));
 }
 public function testThatCanInsertManyObjects()
 {
     $modelTransformer = new ModelToElasticaAutoTransformer();
     $typeMock = $this->getMockBuilder('Elastica_Type')->disableOriginalConstructor()->getMock();
     $typeMock->expects($this->never())->method('deleteById');
     $typeMock->expects($this->never())->method('addDocument');
     $typeMock->expects($this->once())->method('addDocuments');
     $mappingMock = $this->getMockBuilder('FOQ\\ElasticaBundle\\MappingRegistry')->disableOriginalConstructor()->getMock();
     $mappingMock->expects($this->any())->method('getTypeFieldNames')->will($this->returnValue(array('name')));
     $objectPersister = new ObjectPersister($typeMock, $modelTransformer, 'SomeClass', $mappingMock);
     $objectPersister->insertMany(array(new POPO(), new POPO()));
 }