public function testGenTrackingStreamClickUrl() { $kt = new Kontagent(self::KT_HOST, self::KT_API_KEY); $kt_url = 'http://apps.facebook.com/lih_test_lowlevelnew/?kt_type=stream&kt_ut=6114be4c5ecb69e4&kt_uid=1166673718&kt_st1=st111&kt_st2=st222&kt_st3=st333'; $this->setupServerAndGetVar($kt_url); $url = $kt->gen_tracking_stream_click_url('54321'); $items_arry = parse_url($url); $tmp_path_arry = split('/', $items_arry['path']); $len = sizeof($tmp_path_arry); $this->assertEquals( $tmp_path_arry[$len-2], 'psr', 'the message type needs to be psr'); parse_str($items_arry['query'], $r_GET_arry); $this->assertEquals( $r_GET_arry['tu'], 'stream', 'tu should be stream.' ); $this->assertEquals( isset($r_GET_arry['u']), true, 'The unique track needs to there' ); $this->assertEquals( isset($r_GET_arry['st1']), true, 'st1 is missing' ); $this->assertEquals( isset($r_GET_arry['st2']), true, 'st2 is missing' ); $this->assertEquals( isset($r_GET_arry['st3']), true, 'st3 is missing' ); $this->assertEquals( $r_GET_arry['i'] , 0, 'The install needs to be zero'); }
}else{ echo "<script>var kt_landing_str='". $kt->gen_tracking_invite_click_url($uid). "';</script>"; } break; } case 'stream': { if(!$kt->get_send_msg_from_js()){ $kt->track_stream_click($uid); } else { echo "<script>var kt_landing_str='". $kt->gen_tracking_stream_click_url($uid). "';</script>"; } break; } case 'ad': case 'partner': { $short_tag = $kt->gen_short_tracking_code(); if(!$kt->get_send_msg_from_js()){ $kt->track_ucc_click($uid, $short_tag); } else{ echo "<script>var kt_landing_str='". $kt->gen_tracking_ucc_click_url($uid, $short_tag). "';</script>";