本文整理汇总了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);
}