function it_returns_the_filtered_query_as_an_array_with_just_a_filter(FilterInterface $filter) { $filter->toArray()->willReturn(['field' => 'value']); $this->setFilter($filter); $this->toArray()->shouldReturn(['filtered' => ['filter' => [['field' => 'value']]]]); }
function it_returns_the_bool_query_as_a_json(QueryInterface $queryMust, QueryInterface $queryMustNot, QueryInterface $queryShould, FilterInterface $filter) { $queryMust->toArray()->willReturn(['field' => 'value']); $queryMustNot->toArray()->willReturn(['field' => 'value']); $queryShould->toArray()->willReturn(['field' => 'value']); $filter->toArray()->willReturn(['field' => 'value']); $this->setMust($queryMust); $this->setMustNot($queryMustNot); $this->setShould($queryShould); $this->setFilter($filter); $this->toJson()->shouldReturn(json_encode(['bool' => ['must' => [['field' => 'value']], 'must_not' => [['field' => 'value']], 'should' => [['field' => 'value']], 'filter' => [['field' => 'value']]]])); }