/**
  * Tests for toArray().
  */
 public function testToArray()
 {
     $mock = $this->getMock('ONGR\\ElasticsearchDSL\\Query\\Span\\SpanQueryInterface');
     $mock->expects($this->once())->method('toArray')->willReturn(['span_term' => ['key' => 'value']]);
     $query = new SpanNearQuery(['in_order' => false]);
     $query->setSlop(5);
     $query->addQuery($mock);
     $result = ['span_near' => ['clauses' => [0 => ['span_term' => ['key' => 'value']]], 'slop' => 5, 'in_order' => false]];
     $this->assertEquals($result, $query->toArray());
 }
 /**
  * Tests toArray method.
  */
 public function testSpanMultiTermQueryToArray()
 {
     /** @var SpanQueryInterface $mock */
     $mock = $this->mock;
     $query = new SpanNearQuery(['name']);
     $query->setSlop(5);
     $query->addQuery($mock);
     $result = ['clauses' => [0 => ['span_or' => ['key' => 'value']]], 'slop' => 5, 0 => 'name'];
     $this->assertEquals($result, $query->toArray());
 }