當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DashboardController::getHotPostVisualizationData方法代碼示例

本文整理匯總了PHP中DashboardController::getHotPostVisualizationData方法的典型用法代碼示例。如果您正苦於以下問題:PHP DashboardController::getHotPostVisualizationData方法的具體用法?PHP DashboardController::getHotPostVisualizationData怎麽用?PHP DashboardController::getHotPostVisualizationData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DashboardController的用法示例。


在下文中一共展示了DashboardController::getHotPostVisualizationData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetHotPostVisualizationData

 public function testGetHotPostVisualizationData()
 {
     $hot_posts = array((object) array('post_text' => 'First Post', 'favlike_count_cache' => 1, 'all_retweets' => 2, 'reply_count_cache' => 3), (object) array('post_text' => 'Second Post', 'favlike_count_cache' => 10, 'all_retweets' => 20, 'reply_count_cache' => 30));
     $result = DashboardController::getHotPostVisualizationData($hot_posts, 'twitter');
     $this->assertEqual(gettype($result), 'string');
     $visualization_object = json_decode($result);
     $this->assertEqual(sizeof($visualization_object->rows), 2);
     $this->assertEqual(sizeof($visualization_object->cols), 4);
     $this->assertEqual($visualization_object->cols[0]->label, 'Tweet');
     $this->assertEqual($visualization_object->cols[1]->label, 'Replies');
     $this->assertEqual($visualization_object->cols[2]->label, 'Retweets');
     $this->assertEqual($visualization_object->cols[3]->label, 'Favorites');
     $this->assertEqual($visualization_object->rows[0]->c[0]->v, 'First Post...');
     $this->assertEqual($visualization_object->rows[0]->c[1]->v, 3);
     $this->assertEqual($visualization_object->rows[0]->c[2]->v, 2);
     $this->assertEqual($visualization_object->rows[0]->c[3]->v, 1);
     $result = DashboardController::getHotPostVisualizationData($hot_posts, 'facebook');
     $this->assertEqual(gettype($result), 'string');
     $visualization_object = json_decode($result);
     $this->assertEqual(sizeof($visualization_object->rows), 2);
     $this->assertEqual(sizeof($visualization_object->cols), 4);
     $this->assertEqual($visualization_object->cols[0]->label, 'Post');
     $this->assertEqual($visualization_object->cols[1]->label, 'Comments');
     $this->assertEqual($visualization_object->cols[2]->label, 'Shares');
     $this->assertEqual($visualization_object->cols[3]->label, 'Likes');
     $this->assertEqual($visualization_object->rows[1]->c[0]->v, 'Second Post...');
     $this->assertEqual($visualization_object->rows[1]->c[1]->v, 30);
     $this->assertEqual($visualization_object->rows[1]->c[2]->v, 20);
     $this->assertEqual($visualization_object->rows[1]->c[3]->v, 10);
 }
開發者ID:rudimk,項目名稱:Outro,代碼行數:30,代碼來源:TestOfDashboardController.php


注:本文中的DashboardController::getHotPostVisualizationData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。