public function testTwitterNoMatches() { // on twitter // set up single popular post $builders[] = FixtureBuilder::build('posts', array('post_text' => 'This is very shared', 'pub_date' => '2015-02-07', 'author_username' => $this->instance->network_username, 'network' => $this->instance->network, 'retweet_count_api' => 0)); $posts = array(); $insight_plugin = new EOYMostRetweetedPostInsight(); $insight_plugin->generateInsight($this->instance, null, $posts, 3); // Assert that insight got inserted $insight_dao = new InsightMySQLDAO(); $year = date('Y'); $result = $insight_dao->getInsight('eoy_most_retweeted', $this->instance->id, $year . '-' . $insight_plugin->run_date); // $this->debug(Utils::varDumpToString($result)); $this->assertNotNull($result); $this->assertIsA($result, "Insight"); $this->assertEqual("Retweets aren't everything", $result->headline); $this->assertEqual("@buffy didn't get any retweets in {$year}, which is a-okay. " . "We're not all here to broadcast.", $result->text); $this->dumpRenderedInsight($result, $this->instance, "No matches: Twitter"); }
public function testFacebookNoMatches() { // now test facebook $this->instance->network_username = '******'; $this->instance->network = 'facebook'; $builders[] = FixtureBuilder::build('posts', array('post_text' => 'This is very shared', 'pub_date' => '2014-02-07', 'author_username' => $this->instance->network_username, 'network' => $this->instance->network, 'retweet_count_api' => 0)); $posts = array(); $insight_plugin = new EOYMostRetweetedPostInsight(); $insight_plugin->generateInsight($this->instance, null, $posts, 3); // Assert that insight got inserted $insight_dao = new InsightMySQLDAO(); $year = date('Y'); $result = $insight_dao->getInsight('eoy_most_retweeted', $this->instance->id, $year . '-' . $insight_plugin->run_date); // $this->debug(Utils::varDumpToString($result)); $this->assertNotNull($result); $this->assertIsA($result, "Insight"); $this->assertEqual("Shares aren't everything", $result->headline); $this->assertEqual("No one shared Buffy Summers's status updates on Facebook " . "in {$year} — not that there's anything wrong with that. Sometimes it's best " . "to keep things close-knit.", $result->text); $this->dumpRenderedInsight($result, $this->instance, "No matches: Facebook"); }