/**
  * Test toArray method.
  */
 public function testToArray()
 {
     $highlight = new Highlight();
     $highlight->addField('ok');
     $highlight->addParameter('_source', ['include' => ['title']]);
     $highlight->setTags(['<tag>'], ['</tag>']);
     $result = $highlight->toArray();
     $expectedResult = ['fields' => ['ok' => new \StdClass()], '_source' => ['include' => ['title']], 'pre_tags' => ['<tag>'], 'post_tags' => ['</tag>']];
     $this->assertEquals($expectedResult, $result);
 }
 /**
  * Tests toArray method.
  */
 public function testHighlightToArray()
 {
     $highlight = new Highlight([new Field('name')]);
     $highlight->setOrder('test');
     $highlight->setHighlighterType('postings');
     $highlight->setFragmentSize(5);
     $highlight->setNumberOfFragments(5);
     $highlight->setTagsSchema('styled');
     $highlight->setTag('tag', 'class');
     $highlight->setTag('only_tag');
     $result = ['order' => 'test', 'type' => 'postings', 'fragment_size' => 5, 'number_of_fragments' => 5, 'tags_schema' => 'styled', 'post_tags' => ['</tag>', '</only_tag>'], 'pre_tags' => ['<tag class="class">', '<only_tag>'], 'fields' => ['name' => ['matched_fields' => ['name']]]];
     $this->assertEquals($result, $highlight->toArray());
 }