/**
  * Test for query toArray() method.
  *
  * @param string $path
  * @param array  $parameters
  * @param array  $expected
  *
  * @dataProvider getArrayDataProvider
  */
 public function testToArray($path, $parameters, $expected)
 {
     $query = new TermsQuery('foo', 'bar');
     $query = new NestedQuery($path, $query, $parameters);
     $result = $query->toArray();
     $this->assertEquals(['nested' => $expected], $result);
 }
 /**
  * Tests toArray method.
  */
 public function testToArray()
 {
     $missingFilterMock = $this->getMockBuilder('ONGR\\ElasticsearchDSL\\Filter\\MissingFilter')->setConstructorArgs(['test_field'])->getMock();
     $missingFilterMock->expects($this->any())->method('getType')->willReturn('test_type');
     $missingFilterMock->expects($this->any())->method('toArray')->willReturn(['testKey' => 'testValue']);
     $result = ['path' => 'test_path', 'query' => ['test_type' => ['testKey' => 'testValue']]];
     $query = new NestedQuery('test_path', $missingFilterMock);
     $this->assertEquals($result, $query->toArray());
 }