public function testFlashbacksInsight()
 {
     $posts = array();
     $instance = new Instance();
     $flashback_insight_plugin = new FlashbackInsight();
     $flashback_insight_plugin->generateInsight($instance, $posts, 3);
     $this->assertTrue(true);
 }
Esempio n. 2
0
 public function testFlashbackInsightForFacebookMoreThanAYearAgo()
 {
     // Get data ready that insight requires
     $builders = self::buildData();
     $instance = new Instance();
     $instance->id = 10;
     $instance->network_user_id = '765432fc';
     $instance->network_username = '******';
     $instance->network = 'facebook';
     $insight_plugin = new FlashbackInsight();
     TimeHelper::setTime(2);
     $insight_plugin->generateInsight($instance, null, $last_week_of_posts, 3);
     // Assert that insight got inserted
     $insight_dao = new InsightMySQLDAO();
     $today = date('Y-m-d');
     $result = $insight_dao->getInsight('posts_on_this_day_popular_flashback', 10, $today);
     $fav_posts = unserialize($result->related_data);
     //$this->debug(Utils::varDumpToString($result));
     $this->assertNotNull($result);
     $this->assertIsA($result, "Insight");
     $this->assertPattern('/3 years ago today/', $result->headline);
     $last_year = date('Y') - 1;
     $this->assertEqual("On this day in 2013, this was testeriffic's most popular status update.", $result->text);
     $this->assertIsA($fav_posts, "array");
     $this->assertIsA($fav_posts["posts"][0], "Post");
     $this->assertEqual(count($fav_posts), 1);
     $this->debug($this->getRenderedInsightInHTML($result));
     $this->debug($this->getRenderedInsightInEmail($result));
 }