/**
  * 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 if endpoint returns builders.
  */
 public function testEndpointGetter()
 {
     $highlightName = 'acme_highlight';
     $highlight = new Highlight();
     $highlight->addField('acme');
     $endpoint = new HighlightEndpoint();
     $endpoint->add($highlight, $highlightName);
     $builders = $endpoint->getAll();
     $this->assertCount(1, $builders);
     $this->assertSame($highlight, $builders[$highlightName]);
 }