public function testSingleLongLostContact()
 {
     // Get data ready that insight requires
     $builders = self::buildData($multiple = false);
     $instance = new Instance();
     $instance->id = 10;
     $instance->network_user_id = 7612345;
     $instance->network_username = '******';
     $instance->network = 'twitter';
     $insight_plugin = new LongLostContactsInsight();
     $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('long_lost_contacts', 10, $today);
     $contacts = unserialize($result->related_data);
     $this->debug(Utils::varDumpToString($result));
     $this->assertNotNull($result);
     $this->assertIsA($result, "Insight");
     $this->assertPattern('/\\@twitteruser hasn\'t replied to /', $result->headline);
     $this->assertPattern('/Twitter Follower One /', $result->headline);
     $this->assertPattern('/in over a year/', $result->headline);
     $this->assertPattern('/avatar.jpg/', $result->header_image);
     $this->assertNoPattern('/people/', $result->headline);
     $this->assertIsA($contacts, "array");
     $this->assertIsA($contacts["people"][0], "User");
     $this->assertEqual(count($contacts["people"]), 1);
     $this->debug($this->getRenderedInsightInHTML($result));
     $this->debug($this->getRenderedInsightInEmail($result));
 }
 public function testLongLostContactsInsight()
 {
     // Get data ready that insight requires
     $builders = self::buildData();
     $instance = new Instance();
     $instance->id = 10;
     $instance->network_user_id = 7612345;
     $instance->network_username = '******';
     $instance->network = 'twitter';
     $insight_plugin = new LongLostContactsInsight();
     $insight_plugin->generateInsight($instance, $last_week_of_posts, 3);
     // Assert that insight got inserted
     $insight_dao = new InsightMySQLDAO();
     $today = date('Y-m-d');
     $result = $insight_dao->getInsight('long_lost_contacts', 10, $today);
     $contacts = unserialize($result->related_data);
     $this->debug(Utils::varDumpToString($result));
     $this->assertNotNull($result);
     $this->assertIsA($result, "Insight");
     $this->assertPattern('/\\@twitteruser hasn\'t replied to /', $result->text);
     $this->assertPattern('/<strong>2 contacts<\\/strong> /', $result->text);
     $this->assertPattern('/in over a year: /', $result->text);
     $this->assertNoPattern('/a contact/', $result->text);
     $this->assertIsA($contacts, "array");
     $this->assertIsA($contacts[0], "User");
     $this->assertEqual(count($contacts), 2);
 }