public function testSplitOpinionsEqualSplit()
 {
     $post_builder = FixtureBuilder::build('posts', array('id' => 1, 'post_id' => '1', 'author_username' => 'ev', 'post_text' => 'My Great Video', 'pub_date' => '-1d', 'network' => 'youtube'));
     $video_builder = FixtureBuilder::build('videos', array('id' => 1, 'post_key' => '1', 'likes' => 50, 'dislikes' => 50));
     $posts[] = new Post($post_builder->columns);
     $instance = new Instance();
     $instance->id = 1;
     $instance->network_user_id = 1;
     $instance->network = 'youtube';
     $instance->network_username = '******';
     $split_opinions_insight = new SplitOpinionsInsight();
     $split_opinions_insight->generateInsight($instance, null, $posts, 7);
     $insight_dao = new InsightMySQLDAO();
     $result = $insight_dao->getInsight('split_opinions1', 1, date('Y-m-d', strtotime('-1 day')));
     $this->assertNotNull($result);
     $this->assertEqual($result->slug, 'split_opinions1');
     $this->assertEqual($result->filename, 'splitopinions');
     $this->assertEqual($result->headline, "My Great Video really touched a nerve!");
     $this->assertEqual($result->emphasis, 1);
     $text = "/50% of people liked ";
     $text .= "<a href=\"http:\\/\\/plus\\.google\\.com\\/1\\/about\"\\>ev\\<\\/a\\>'s";
     $text .= " video \\<a href=\"http:\\/\\/www\\.youtube\\.com\\/watch\\?v=1\">My Gre";
     $text .= "at Video\\<\\/a\\> and 50% disliked it\\./";
     $this->assertPattern($text, $result->text);
 }
 public function testSplitOpinionsEqualSplit()
 {
     $post_builder = FixtureBuilder::build('posts', array('id' => 1, 'post_id' => '1', 'author_username' => 'ev', 'post_text' => 'My Great Video', 'pub_date' => '-1d', 'network' => 'youtube'));
     $video_builder = FixtureBuilder::build('videos', array('id' => 1, 'post_key' => '1', 'likes' => 50, 'dislikes' => 50));
     $posts[] = new Post($post_builder->columns);
     $instance = new Instance();
     $instance->id = 1;
     $instance->network_user_id = 1;
     $instance->network = 'youtube';
     $instance->network_username = '******';
     $split_opinions_insight = new SplitOpinionsInsight();
     $split_opinions_insight->generateInsight($instance, $posts, 7);
     $insight_dao = new InsightMySQLDAO();
     $result = $insight_dao->getInsight('split_opinions1', 1, date('Y-m-d', strtotime('-1 day')));
     $this->assertNotNull($result);
     $this->assertEqual($result->slug, 'split_opinions1');
     $this->assertEqual($result->headline, 'Split opinion:');
     $this->assertEqual($result->filename, 'splitopinions');
     $this->assertEqual($result->emphasis, 1);
     $text = "<a href=http://plus.google.com/1/about>ev</a>'s video <a href=http://www.youtube.com/watch?v=1>My Gre";
     $text .= "at Video</a> really touched a nerve! 50% of people liked it and 50% disliked it.";
     $this->assertEqual($result->text, $text);
 }