public function testFacebookOneMatch()
 {
     $this->instance->network_username = '******';
     $this->instance->network = 'facebook';
     $year = date('Y');
     $builders = self::setUpPublicInsight($this->instance);
     // most popular link
     $builders[] = FixtureBuilder::build('posts', array('id' => 10, 'post_id' => 10, 'author_username' => $this->instance->network_username, 'author_user_id' => $this->instance->network_user_id, 'author_fullname' => 'Facebook User', 'author_avatar' => 'avatar.jpg', 'network' => $this->instance->network, 'post_text' => 'This is a post http://t.co/B5LAotKMWY with a v popular link', 'source' => 'web', 'pub_date' => "{$year}-03-01", 'reply_count_cache' => 10, 'is_protected' => false));
     $builders[] = FixtureBuilder::Build('links', array('post_key' => 10, 'url' => 'http://t.co/B5LAotKMWY', 'image_src' => '', 'expanded_url' => 'http://example.com/linkin'));
     $posts = array();
     $insight_plugin = new EOYPopularLinkInsight();
     $insight_plugin->generateInsight($this->instance, null, $posts, 3);
     // Assert that insight got inserted
     $insight_dao = new InsightMySQLDAO();
     $result = $insight_dao->getInsight('eoy_popular_link', $this->instance->id, $year . '-' . $insight_plugin->run_date);
     $this->assertNotNull($result);
     $this->assertIsA($result, "Insight");
     $year = date('Y');
     $this->assertEqual("Mark Zuckerberg's most popular link on Facebook, {$year}", $result->headline);
     $this->assertEqual("We laughed, we cried, we linked. This is the most popular " . "link Mark Zuckerberg shared on Facebook in {$year} (at least since March).", $result->text);
     $this->dumpRenderedInsight($result, $this->instance, "One match, Facebook");
 }
 public function testFacebookOneMatch()
 {
     $this->instance->network_username = '******';
     $this->instance->network = 'facebook';
     $year = date('Y');
     $builders = self::setUpPublicInsight($this->instance);
     // most popular pic
     $builders[] = FixtureBuilder::build('posts', array('id' => 10, 'post_id' => 10, 'author_username' => $this->instance->network_username, 'author_user_id' => $this->instance->network_user_id, 'author_fullname' => 'Facebook User', 'author_avatar' => 'avatar.jpg', 'network' => $this->instance->network, 'post_text' => 'This is a post http://t.co/B5LAotKMWY with a v popular pic', 'source' => 'web', 'pub_date' => "{$year}-03-01", 'reply_count_cache' => 10, 'is_protected' => false));
     $builders[] = FixtureBuilder::Build('links', array('post_key' => 10, 'url' => 'https://www.facebook.com/photo.php?afdsadf', 'image_src' => 'https://pbs.twimg.com/media/B25u8s7CYAAQyxN.jpg', 'expanded_url' => 'http://pic.twitter.com/vx4YL7Yz'));
     $posts = array();
     $insight_plugin = new EOYPopularPicInsight();
     $insight_plugin->generateInsight($this->instance, null, $posts, 3);
     // Assert that insight got inserted
     $insight_dao = new InsightMySQLDAO();
     $result = $insight_dao->getInsight('eoy_popular_pic', $this->instance->id, $year . '-' . $insight_plugin->run_date);
     $this->assertNotNull($result);
     $this->assertIsA($result, "Insight");
     $year = date('Y');
     $this->assertEqual("Mark Zuckerberg's most popular picture on Facebook, {$year}", $result->headline);
     $this->assertEqual("What's a newsfeed without the photos? In {$year}, this " . "was the most popular pic Mark Zuckerberg shared on Facebook (at least since March).", $result->text);
     $this->dumpRenderedInsight($result, $this->instance, "One match, Facebook");
 }
 public function testAlternateHeadline2()
 {
     TimeHelper::setTime(3);
     $builders[] = FixtureBuilder::build('posts', array('id' => 135, 'post_id' => 135, 'author_user_id' => 1234, 'author_username' => $this->instance->network_username, 'author_fullname' => 'Twitter User', 'author_avatar' => 'avatar.jpg', 'network' => 'twitter', 'post_text' => 'This is a post http://t.co/B5LAotKMWY with a link.', 'source' => 'web', 'pub_date' => date('Y-m-d', strtotime('-8 days')), 'reply_count_cache' => 0, 'is_protected' => 0));
     $builders[] = FixtureBuilder::Build('links', array('post_key' => 135, 'url' => 'http://pic.twitter.com/vx4YL7Yz', 'image_src' => 'http://pic.twitter.com.foo.jpg', 'expanded_url' => ''));
     $insight_plugin = new PhotoPromptInsight();
     $insight_dao = DAOFactory::getDAO('InsightDAO');
     $posts = array();
     $insight_plugin->generateInsight($this->instance, null, $posts, 3);
     $result = $insight_dao->getInsight('photoprompt', $this->instance->id, date('Y-m-d'));
     $this->assertNotNull($result);
     $this->assertEqual("A great time for a pic", $result->headline);
     $this->assertEqual("@anseladams hasn't posted a photo in 8 days. " . "It might be worth finding something to share.", $result->text);
     $this->debug($this->getRenderedInsightInHTML($result));
     $this->debug($this->getRenderedInsightInEmail($result));
 }