/**
  * Destructor.
  */
 public function __destruct()
 {
     // Clear scroll if initialized
     if ($this->isScrollable()) {
         $this->manager->clearScroll($this->scrollId);
     }
 }
예제 #2
0
 /**
  * Test for clearScroll().
  */
 public function testClearScroll()
 {
     $esClient = $this->getMock('Elasticsearch\\Client', ['clearScroll'], [], '', false);
     $esClient->expects($this->once())->method('clearScroll')->with(['scroll_id' => 'foo']);
     $metadataCollector = $this->getMockBuilder('ONGR\\ElasticsearchBundle\\Mapping\\MetadataCollector')->disableOriginalConstructor()->getMock();
     $converter = $this->getMockBuilder('ONGR\\ElasticsearchBundle\\Result\\Converter')->disableOriginalConstructor()->getMock();
     $config = ['readonly' => false];
     $manager = new Manager('test', $config, $esClient, ['index' => 'test'], $metadataCollector, $converter);
     $manager->clearScroll('foo');
 }