protected function appendMetadata($collection)
 {
     if (!empty($this->wg->EnablePOIExt)) {
         $helper = new QuestDetailsSolrHelper();
         $questDetailsSearch = new QuestDetailsSearchService();
         $metadata = $questDetailsSearch->newQuery()->withIds(array_keys($collection), $this->wg->CityId)->search();
         $metadata = $helper->processMetadata($metadata);
         foreach ($collection as &$item) {
             $key = $this->wg->CityId . "_" . $item["id"];
             if (isset($metadata[$key])) {
                 $item["metadata"] = $metadata[$key];
             }
         }
     }
     return $collection;
 }
 public function testShouldProcessMetadata()
 {
     $questDetailsSearch = $this->getMockedQuestDetailsSearchService();
     $helper = new QuestDetailsSolrHelper();
     $result = $questDetailsSearch->newQuery()->search();
     $processed = $helper->processMetadata($result);
     $expected = ['1018050_2151' => ['map_location' => ['region' => '1b', 'id' => '2303', 'latitude' => -75.73730500000001, 'longitude' => -112.851562], 'poi_id' => '15908', 'poi_category_id' => '5062', 'fingerprints' => [0 => 'f31'], 'parent_poi_category_id' => '3', 'ability_id' => '33', 'quest_id' => 'f32']];
     $this->assertEquals($expected, $processed);
 }