public function testHelloThinkUpInsight() { $posts = array(); $instance = new Instance(); $instance->id = 1; $instance->network_username = '******'; $instance->network = 'facebook'; $builders = self::setUpPublicInsight($instance); // We have three random options, so we'll check each one here. TimeHelper::setTime(3); $hello_thinkup_insight_plugin = new HelloThinkUpInsight(); $hello_thinkup_insight_plugin->generateInsight($instance, null, $posts, 3); $insight_dao = DAOFactory::getDAO('InsightDAO'); $result = $insight_dao->getInsight('my_test_insight_hello_thinkup', 1, date('Y-m-d')); $this->assertEqual($result->headline, 'Ohai'); $this->assertEqual($result->text, 'Greetings, humans'); $this->assertEqual($result->filename, 'hellothinkupinsight'); $this->assertNull($result->related_data); $this->assertEqual($result->emphasis, Insight::EMPHASIS_MED); TimeHelper::setTime(4); $hello_thinkup_insight_plugin->generateInsight($instance, null, $posts, 3); $insight_dao = DAOFactory::getDAO('InsightDAO'); $result = $insight_dao->getInsight('my_test_insight_hello_thinkup', 1, date('Y-m-d')); $this->assertEqual($result->headline, 'Hello'); $this->assertEqual($result->text, 'Greetings, earthlings'); TimeHelper::setTime(5); $hello_thinkup_insight_plugin->generateInsight($instance, null, $posts, 3); $insight_dao = DAOFactory::getDAO('InsightDAO'); $result = $insight_dao->getInsight('my_test_insight_hello_thinkup', 1, date('Y-m-d')); $this->assertEqual($result->headline, 'Yo'); $this->assertEqual($result->text, 'Greetings, peeps'); /** * Use this code to output the individual insight's fully-rendered HTML to file. * Then, open the file in your browser to view. * * $ TEST_DEBUG=1 php webapp/plugins/insightsgenerator/tests/TestOfHelloThinkUpInsight.php * -t testHelloThinkUpInsight > webapp/insight.html */ $controller = new InsightStreamController(); $_GET['u'] = 'Katniss Everdeen'; $_GET['n'] = 'facebook'; $_GET['d'] = date('Y-m-d'); $_GET['s'] = 'my_test_insight_hello_thinkup'; $results = $controller->go(); //Uncomment this out to see web view of insight //$this->debug($results); /** * Use this code to output the individual insight's fully-rendered email HTML to file. * Then, open the file in your browser to view. * * $ TEST_DEBUG=1 php webapp/plugins/insightsgenerator/tests/TestOfHelloThinkUpInsight.php * -t testHelloThinkUpInsight > webapp/insight_email.html */ $email_insight = $this->getRenderedInsightInEmail($result); //Uncomment this out to see the email view of insight //$this->debug($email_insight); }
public function testHelloThinkUpInsight() { $posts = array(); $instance = new Instance(); $hello_thinkup_insight_plugin = new HelloThinkUpInsight(); $hello_thinkup_insight_plugin->generateInsight($instance, $posts, 3); $this->assertTrue(true); }
public function testHelloThinkUpInsight() { $posts = array(); $instance = new Instance(); $hello_thinkup_insight_plugin = new HelloThinkUpInsight(); $hello_thinkup_insight_plugin->generateInsight($instance, $posts, 3); $insight_dao = new InsightMySQLDAO(); $result = $insight_dao->getInsight('my_test_insight_hello_thinkup', 1, '2013-12-21'); $this->assertEqual($result->headline, 'Ohai'); $this->assertEqual($result->text, 'Greetings humans'); $this->assertEqual($result->filename, 'hellothinkupinsight'); $this->assertNull($result->related_data); $this->assertEqual($result->emphasis, Insight::EMPHASIS_MED); }