當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FixtureBuilder::Build方法代碼示例

本文整理匯總了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");
 }
開發者ID:pepeleproso,項目名稱:ThinkUp,代碼行數:22,代碼來源:TestOfEOYPopularLinkInsight.php

示例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");
 }
開發者ID:ngugijames,項目名稱:ThinkUp,代碼行數:22,代碼來源:TestOfEOYPopularPicInsight.php

示例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));
 }
開發者ID:pepeleproso,項目名稱:ThinkUp,代碼行數:16,代碼來源:TestOfPhotoPromptInsight.php


注:本文中的FixtureBuilder::Build方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。