/** * 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 get Type method. */ public function testSpanFirstQueryGetType() { /** @var SpanQueryInterface $mock */ $mock = $this->mock; $query = new SpanFirstQuery($mock, 5); $result = $query->getType(); $this->assertEquals('span_first', $result); }