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