/** @brief Constructs new cluster helper instance. * * @param $cluster [in] One cluster reply. * @param $meta [in] Reply set meta data. * @param $facet_helper [in] Facet helper (used to retrieve value label). * @param $query [in] AfsQuery object previously initialized. It is used to * generate new query to filter on this cluster reply. * @param $config [in] Helper configuration. */ public function __construct($cluster, AfsMetaHelper $meta, $facet_helper, AfsQuery $query, AfsHelperConfiguration $config) { $formatter = AfsFacetHelperRetriever::get_formatter($meta->get_cluster_id(), $query); $this->id = $formatter->format($cluster->id); $this->initialize_label($facet_helper); $this->total_replies = $cluster->totalItems; $factory = new AfsReplyHelperFactory($config->get_reply_text_visitor()); $this->replies = $factory->create_replies($meta->get_feed(), $cluster); $this->query = $query->auto_set_from()->unset_cluster()->add_filter($meta->get_cluster_id(), $this->id); $this->config = $config; }
/** * @expectedException AfsUnknowPromoteTypeException * @expectedExceptionMessage Unknow promote type: bidon */ public function testUnknowPromoteType() { $clientData = '<afs:type xmlns:afs=\\"http://ref.antidot.net/7.3/bo.xsd\\">bidon</afs:type><afs:customData xmlns:afs=\\"http://ref.antidot.net/7.3/bo.xsd\\"/>'; $reply = json_decode('{ "docId": 180, "uri": "http://foo.bar.baz/14", "relevance" : {"rank" : 1}, "clientData": [ { "contents": " ' . $clientData . '", "id": "main", "mimeType": "text/xml" } ] }'); $text_visitor = new TestTextVisitor(); $factory = new AfsReplyHelperFactory($text_visitor); $factory->create('Promote', $reply); }