本文整理汇总了PHP中FixtureBuilder::Build方法的典型用法代码示例。如果您正苦于以下问题:PHP FixtureBuilder::Build方法的具体用法?PHP FixtureBuilder::Build怎么用?PHP FixtureBuilder::Build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FixtureBuilder
的用法示例。
在下文中一共展示了FixtureBuilder::Build方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFacebookOneMatch
public function testFacebookOneMatch()
{
$this->instance->network_username = 'Mark Zuckerberg';
$this->instance->network = 'facebook';
$year = date('Y');
$builders = self::setUpPublicInsight($this->instance);
// most popular link
$builders[] = FixtureBuilder::build('posts', array('id' => 10, 'post_id' => 10, 'author_username' => $this->instance->network_username, 'author_user_id' => $this->instance->network_user_id, 'author_fullname' => 'Facebook User', 'author_avatar' => 'avatar.jpg', 'network' => $this->instance->network, 'post_text' => 'This is a post http://t.co/B5LAotKMWY with a v popular link', 'source' => 'web', 'pub_date' => "{$year}-03-01", 'reply_count_cache' => 10, 'is_protected' => false));
$builders[] = FixtureBuilder::Build('links', array('post_key' => 10, 'url' => 'http://t.co/B5LAotKMWY', 'image_src' => '', 'expanded_url' => 'http://example.com/linkin'));
$posts = array();
$insight_plugin = new EOYPopularLinkInsight();
$insight_plugin->generateInsight($this->instance, null, $posts, 3);
// Assert that insight got inserted
$insight_dao = new InsightMySQLDAO();
$result = $insight_dao->getInsight('eoy_popular_link', $this->instance->id, $year . '-' . $insight_plugin->run_date);
$this->assertNotNull($result);
$this->assertIsA($result, "Insight");
$year = date('Y');
$this->assertEqual("Mark Zuckerberg's most popular link on Facebook, {$year}", $result->headline);
$this->assertEqual("We laughed, we cried, we linked. This is the most popular " . "link Mark Zuckerberg shared on Facebook in {$year} (at least since March).", $result->text);
$this->dumpRenderedInsight($result, $this->instance, "One match, Facebook");
}
示例2: testFacebookOneMatch
public function testFacebookOneMatch()
{
$this->instance->network_username = 'Mark Zuckerberg';
$this->instance->network = 'facebook';
$year = date('Y');
$builders = self::setUpPublicInsight($this->instance);
// most popular pic
$builders[] = FixtureBuilder::build('posts', array('id' => 10, 'post_id' => 10, 'author_username' => $this->instance->network_username, 'author_user_id' => $this->instance->network_user_id, 'author_fullname' => 'Facebook User', 'author_avatar' => 'avatar.jpg', 'network' => $this->instance->network, 'post_text' => 'This is a post http://t.co/B5LAotKMWY with a v popular pic', 'source' => 'web', 'pub_date' => "{$year}-03-01", 'reply_count_cache' => 10, 'is_protected' => false));
$builders[] = FixtureBuilder::Build('links', array('post_key' => 10, 'url' => 'https://www.facebook.com/photo.php?afdsadf', 'image_src' => 'https://pbs.twimg.com/media/B25u8s7CYAAQyxN.jpg', 'expanded_url' => 'http://pic.twitter.com/vx4YL7Yz'));
$posts = array();
$insight_plugin = new EOYPopularPicInsight();
$insight_plugin->generateInsight($this->instance, null, $posts, 3);
// Assert that insight got inserted
$insight_dao = new InsightMySQLDAO();
$result = $insight_dao->getInsight('eoy_popular_pic', $this->instance->id, $year . '-' . $insight_plugin->run_date);
$this->assertNotNull($result);
$this->assertIsA($result, "Insight");
$year = date('Y');
$this->assertEqual("Mark Zuckerberg's most popular picture on Facebook, {$year}", $result->headline);
$this->assertEqual("What's a newsfeed without the photos? In {$year}, this " . "was the most popular pic Mark Zuckerberg shared on Facebook (at least since March).", $result->text);
$this->dumpRenderedInsight($result, $this->instance, "One match, Facebook");
}
示例3: testAlternateHeadline2
public function testAlternateHeadline2()
{
TimeHelper::setTime(3);
$builders[] = FixtureBuilder::build('posts', array('id' => 135, 'post_id' => 135, 'author_user_id' => 1234, 'author_username' => $this->instance->network_username, 'author_fullname' => 'Twitter User', 'author_avatar' => 'avatar.jpg', 'network' => 'twitter', 'post_text' => 'This is a post http://t.co/B5LAotKMWY with a link.', 'source' => 'web', 'pub_date' => date('Y-m-d', strtotime('-8 days')), 'reply_count_cache' => 0, 'is_protected' => 0));
$builders[] = FixtureBuilder::Build('links', array('post_key' => 135, 'url' => 'http://pic.twitter.com/vx4YL7Yz', 'image_src' => 'http://pic.twitter.com.foo.jpg', 'expanded_url' => ''));
$insight_plugin = new PhotoPromptInsight();
$insight_dao = DAOFactory::getDAO('InsightDAO');
$posts = array();
$insight_plugin->generateInsight($this->instance, null, $posts, 3);
$result = $insight_dao->getInsight('photoprompt', $this->instance->id, date('Y-m-d'));
$this->assertNotNull($result);
$this->assertEqual("A great time for a pic", $result->headline);
$this->assertEqual("@anseladams hasn't posted a photo in 8 days. " . "It might be worth finding something to share.", $result->text);
$this->debug($this->getRenderedInsightInHTML($result));
$this->debug($this->getRenderedInsightInEmail($result));
}