/** * Tests for toArray(). */ public function testToArray() { $mock = $this->getMock('ONGR\\ElasticsearchDSL\\Query\\Span\\SpanQueryInterface'); $mock->expects($this->once())->method('toArray')->willReturn(['span_term' => ['user' => 'bob']]); $query = new SpanFirstQuery($mock, 5); $result = ['span_first' => ['match' => ['span_term' => ['user' => 'bob']], 'end' => 5]]; $this->assertEquals($result, $query->toArray()); }
/** * Tests toArray method. */ public function testSpanFirstQueryToArray() { /** @var SpanQueryInterface $mock */ $mock = $this->mock; $query = new SpanFirstQuery($mock, 5); $result = ['match' => ['span_or' => ['key' => 'value']], 'end' => 5]; $this->assertEquals($result, $query->toArray()); }