/** * 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); }