当前位置: 首页>>代码示例>>PHP>>正文


PHP InsightPluginParent::shouldGenerateWeeklyInsight方法代码示例

本文整理汇总了PHP中InsightPluginParent::shouldGenerateWeeklyInsight方法的典型用法代码示例。如果您正苦于以下问题:PHP InsightPluginParent::shouldGenerateWeeklyInsight方法的具体用法?PHP InsightPluginParent::shouldGenerateWeeklyInsight怎么用?PHP InsightPluginParent::shouldGenerateWeeklyInsight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InsightPluginParent的用法示例。


在下文中一共展示了InsightPluginParent::shouldGenerateWeeklyInsight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testShouldGenerateWeeklyInsight

 public function testShouldGenerateWeeklyInsight()
 {
     $instance = new Instance();
     $instance->id = 10;
     $instance->network_username = 'testeriffic';
     $instance->network = 'twitter';
     $time_now = date("Y-m-d H:i:s");
     $today = date('Y-m-d', strtotime('today'));
     $yesterday = date('Y-m-d', strtotime('-1 day'));
     $builders = array();
     $builders[] = FixtureBuilder::build('insights', array('id' => 76, 'instance_id' => 10, 'slug' => 'some_slug', 'date' => $today, 'time_generated' => $time_now));
     $builders[] = FixtureBuilder::build('insights', array('id' => 77, 'instance_id' => 10, 'slug' => 'some_other_slug', 'date' => $yesterday, 'time_generated' => $time_now));
     $insight_plugin_parent = new InsightPluginParent();
     $insight_plugin_parent->insight_dao = DAOFactory::getDAO('InsightDAO');
     // Test default values
     $this->assertTrue($insight_plugin_parent->shouldGenerateWeeklyInsight('a_slug', $instance));
     $this->assertFalse($insight_plugin_parent->shouldGenerateWeeklyInsight('some_slug', $instance));
     // Test regeneration on a given date
     $this->assertTrue($insight_plugin_parent->shouldGenerateWeeklyInsight('a_slug', $instance, $insight_date = $today));
     $this->assertFalse($insight_plugin_parent->shouldGenerateWeeklyInsight('some_other_slug', $instance, $insight_date = $yesterday));
     $this->assertTrue($insight_plugin_parent->shouldGenerateWeeklyInsight('some_other_slug', $instance, $insight_date = $yesterday, $regenerate_existing_insight = true));
     // Test for day of week
     $dow1 = date('w');
     $dow2 = date('w', strtotime('-1 day'));
     $this->assertTrue($insight_plugin_parent->shouldGenerateWeeklyInsight('a_slug', $instance, $insight_date = 'today', $regenerate_existing_insight = false, $day_of_week = $dow1));
     $this->assertFalse($insight_plugin_parent->shouldGenerateWeeklyInsight('a_slug', $instance, $insight_date = 'today', $regenerate_existing_insight = false, $day_of_week = $dow2));
     // Test with last week of posts
     $this->assertTrue($insight_plugin_parent->shouldGenerateWeeklyInsight('a_slug', $instance, $insight_date = 'today', $regenerate_existing_insight = false, $day_of_week = null, $count_last_week_of_posts = 13));
     $this->assertFalse($insight_plugin_parent->shouldGenerateWeeklyInsight('a_slug', $instance, $insight_date = 'today', $regenerate_existing_insight = false, $day_of_week = null, $count_last_week_of_posts = 0));
     // Test excluded networks
     $this->assertTrue($insight_plugin_parent->shouldGenerateWeeklyInsight('a_slug', $instance, $insight_date = 'today', $regenerate_existing_insight = false, $day_of_week = null, $count_last_week_of_posts = null, $excluded_networks = array('facebook')));
     $this->assertFalse($insight_plugin_parent->shouldGenerateWeeklyInsight('a_slug', $instance, $insight_date = 'today', $regenerate_existing_insight = false, $day_of_week = null, $count_last_week_of_posts = null, $excluded_networks = array('twitter', 'facebook')));
 }
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:33,代码来源:TestOfInsightPluginParent.php


注:本文中的InsightPluginParent::shouldGenerateWeeklyInsight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。