Ejemplo n.º 1
0
 /**
  * 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 SpanOrQuery();
     $query->addQuery($mock);
     $result = ['span_or' => ['clauses' => [0 => ['span_term' => ['key' => 'value']]]]];
     $this->assertEquals($result, $query->toArray());
     $result = $query->getQueries();
     $this->assertInternalType('array', $result);
     $this->assertEquals(1, count($result));
 }
Ejemplo n.º 2
0
 /**
  * Tests toArray method.
  */
 public function testSpanOrQueryToArray()
 {
     /** @var SpanQueryInterface $mock */
     $mock = $this->mock;
     $query = new SpanOrQuery();
     $query->addQuery($mock);
     $result = ['clauses' => [0 => ['span_or' => ['key' => 'value']]]];
     $this->assertEquals($result, $query->toArray());
     $result = $query->getQueries();
     $this->assertInternalType('array', $result);
     $this->assertEquals(1, count($result));
 }