Ejemplo n.º 1
0
 /**
  * @test
  */
 public function it_can_search_with_a_query()
 {
     /**
      *
      * Set
      *
      */
     $queryMock = m::mock('Menthol\\Flexible\\Query');
     $query['index'] = 'my_index';
     $query['type'] = 'my_type';
     $query['body']['query']['match']['testField'] = 'abc';
     /**
      *
      * Expectation
      *
      */
     $queryMock->shouldReceive('execute')->andReturn('result');
     App::shouldReceive('make')->with('menthol.flexible.query', ['proxy' => $this->proxy, 'term' => null, 'options' => array_merge(['query' => $query], ['option'])])->once()->andReturn($queryMock);
     /**
      *
      * Assertion
      *
      */
     $result = $this->proxy->searchByQuery($query, ['option']);
     $this->assertEquals('result', $result);
 }