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


PHP FixtureBuilder类代码示例

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

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

示例1: build

 /**
  * Builds our data
  * @param str table name (without prefix)
  * @param array hash args of column values (optional)
  * @param bool debug (defaults to false)
  * @return FixtureBuilder our builder object with column values
  */
 public static function build($table, $args = null, $debug = false)
 {
     $builder = new FixtureBuilder($debug);
     $builder->buildData($table, $args);
     $builder->table = $table;
     return $builder;
 }
开发者ID:rayyan,项目名称:ThinkUp,代码行数:14,代码来源:class.FixtureBuilder.php


示例2: buildData

 private function buildData()
 {
     // Create a owner
     $builders = array();
     $builders[] = FixtureBuilder::build('users', array('user_id' => '113612142759476883204', 'network' => 'foursquare'));
     return $builders;
 }
开发者ID:73sl4,项目名称:ThinkUp,代码行数:7,代码来源:TestOfFoursquareCrawler.php


示例3: buildData

 protected function buildData()
 {
     $session = new Session();
     $cryptpass = $session->pwdcrypt("oldpassword");
     $builder = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => 'me@example.com', 'pwd' => $cryptpass, 'activation_code' => 8888, 'is_activated' => 1));
     return $builder;
 }
开发者ID:hendrasaputra,项目名称:ThinkUp,代码行数:7,代码来源:TestOfForgotPasswordController.php


示例4: testOutput

 public function testOutput()
 {
     //not logged in
     $controller = new TwitterPluginHashtagConfigurationController(null, 'twitter', 'ginatrapani');
     $output = $controller->go();
     $v_mgr = $controller->getViewManager();
     $config = Config::getInstance();
     $this->assertEqual('You must <a href="' . $config->getValue('site_root_path') . 'session/login.php">log in</a> to do this.', $v_mgr->getTemplateDataItem('error_msg'));
     //logged in, no user set up
     $this->simulateLogin('me@example.com');
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     $controller = new TwitterPluginHashtagConfigurationController(null, 'twitter', 'ginatrapani');
     $output = $controller->go();
     $v_mgr = $controller->getViewManager();
     $this->assertIsA($v_mgr->getTemplateDataItem('user'), 'string');
     $this->assertEqual('Twitter user @ginatrapani does not exist.', $v_mgr->getTemplateDataItem('error_msg'));
     //logged in, user set up
     $builders = array();
     $builders[] = FixtureBuilder::build('instances', array('network_username' => 'ginatrapani', 'network' => 'twitter'));
     $controller = new TwitterPluginHashtagConfigurationController(null, 'twitter', 'ginatrapani');
     $output = $controller->go();
     $v_mgr = $controller->getViewManager();
     $this->assertIsA($v_mgr->getTemplateDataItem('user'), 'string');
     $this->assertIsA($v_mgr->getTemplateDataItem('hashtags'), 'array');
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:26,代码来源:TestOfTwitterPluginHashtagConfigurationController.php


示例5: testIsConfigured

 public function testIsConfigured()
 {
     $plugin = new Plugin(array('id' => 1, 'folder_name' => 'twitter', 'name' => 'Twitter Plugin', 'description' => '', 'version' => '0.10', 'author' => 'Gina Trapani', 'homepage' => '', 'is_active' => 1));
     //no options, no requirements
     $this->assertTrue($plugin->isConfigured());
     //option, no requirements
     $builders[] = FixtureBuilder::build('options', array('namespace' => 'plugin_options-1', 'option_name' => 'api_key', 'option_value' => 'mykeyeeeee'));
     $plugin->options_hash = null;
     $this->assertTrue($plugin->isConfigured());
     //requirement AND option
     $plugin->addRequiredSetting('api_key');
     $plugin->options_hash = null;
     $this->assertTrue($plugin->isConfigured());
     //another requirements without a matching setting
     $plugin->addRequiredSetting('another_thinger');
     $plugin->options_hash = null;
     $this->assertFalse($plugin->isConfigured());
     //2 requirements, 2 set
     $builders[] = FixtureBuilder::build('options', array('namespace' => 'plugin_options-1', 'option_name' => 'another_thinger', 'option_value' => 'mythingerrrrr'));
     $plugin->options_hash = null;
     $this->assertTrue($plugin->isConfigured());
     $builders[] = FixtureBuilder::build('options', array('namespace' => 'plugin_options-1', 'option_name' => 'yet_another_thinger', 'option_value' => 'mythingerrrrr222'));
     $plugin->options_hash = null;
     $this->assertTrue($plugin->isConfigured());
 }
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:25,代码来源:TestOfPlugin.php


示例6: buildPluginOptions

 /**
  * build plugin option values
  */
 private function buildPluginOptions()
 {
     $plugin1 = FixtureBuilder::build('plugins', array('id' => 2, 'folder_name' => 'facebook'));
     $plugin_opt1 = FixtureBuilder::build('plugin_options', array('plugin_id' => 2, 'option_name' => 'facebook_api_key', 'option_value' => "dummy_key"));
     $plugin_opt2 = FixtureBuilder::build('plugin_options', array('plugin_id' => 2, 'option_name' => 'facebook_api_secret', 'option_value' => "dummy_secret"));
     return array($plugin_opt1, $plugin_opt2, $plugin1);
 }
开发者ID:rayyan,项目名称:ThinkUp,代码行数:10,代码来源:TestOfFacebookAuthController.php


示例7: buildData

 private function buildData()
 {
     $builders = array();
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'email' => 'admin@example.com', 'pwd' => 'XXX', 'is_activated' => 1, 'is_admin' => 1));
     //Insert test links (not images, not expanded)
     $counter = 0;
     while ($counter < 40) {
         $post_id = $counter + 80;
         $pseudo_minute = str_pad($counter, 2, "0", STR_PAD_LEFT);
         $builders[] = FixtureBuilder::build('links', array('url' => "http://example.com/{$counter}", 'expanded_url' => null, 'title' => "Link {$counter}", 'clicks' => 0, 'post_id' => $post_id, 'is_image' => 0, 'error' => null));
         $counter++;
     }
     //Insert test links (images on Flickr that don't exist, not expanded)
     $counter = 0;
     while ($counter < 2) {
         $post_id = $counter + 80;
         $pseudo_minute = str_pad($counter, 2, "0", STR_PAD_LEFT);
         $builders[] = FixtureBuilder::build('links', array('url' => "http://flic.kr/p/{$counter}", 'expanded_url' => null, 'title' => "Link {$counter}", 'clicks' => 0, 'post_id' => $post_id, 'is_image' => 1, 'error' => null));
         $counter++;
     }
     // Insert legit Flickr shortened link, not expanded
     $builders[] = FixtureBuilder::build('links', array('url' => "http://flic.kr/p/7QQBy7", 'expanded_url' => null, 'title' => "Link 0", 'clicks' => 0, 'post_id' => 200, 'is_image' => 1, 'error' => null));
     //Insert test links with errors (images from Flickr, not expanded)
     $counter = 0;
     while ($counter < 5) {
         $post_id = $counter + 80;
         $pseudo_minute = str_pad($counter, 2, "0", STR_PAD_LEFT);
         $builders[] = FixtureBuilder::build('links', array('url' => "http://flic.kr/p/{$counter}", 'expanded_url' => null, 'title' => "Link {$counter}", 'clicks' => 0, 'post_id' => $post_id, 'is_image' => 1, 'error' => 'Photo not found'));
         $counter++;
     }
     return $builders;
 }
开发者ID:rayyan,项目名称:ThinkUp,代码行数:32,代码来源:TestOfFlickrThumbnailsPlugin.php


示例8: testShouldGenerateInsight

 public function testShouldGenerateInsight()
 {
     $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->shouldGenerateInsight('a_slug', $instance));
     $this->assertFalse($insight_plugin_parent->shouldGenerateInsight('some_slug', $instance));
     // Test regeneration on a given date
     $this->assertTrue($insight_plugin_parent->shouldGenerateInsight('a_slug', $instance, $insight_date = $today));
     $this->assertFalse($insight_plugin_parent->shouldGenerateInsight('some_other_slug', $instance, $insight_date = $yesterday));
     $this->assertTrue($insight_plugin_parent->shouldGenerateInsight('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->shouldGenerateInsight('a_slug', $instance, $insight_date = 'today', $regenerate_existing_insight = false, $day_of_week = $dow1));
     $this->assertFalse($insight_plugin_parent->shouldGenerateInsight('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->shouldGenerateInsight('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->shouldGenerateInsight('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->shouldGenerateInsight('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->shouldGenerateInsight('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:dgw,项目名称:ThinkUp,代码行数:33,代码来源:TestOfInsightPluginParent.php


示例9: testFromName

 public function testFromName()
 {
     $config = Config::getInstance();
     $config->setValue("app_title_prefix", "My Crazy Custom ");
     $_SERVER['HTTP_HOST'] = "my_thinkup_hostname";
     Mailer::mail('you@example.com', 'Testing 123', 'Me worky, yo?');
     $email_body = Mailer::getLastMail();
     $this->debug($email_body);
     $this->assertPattern('/From: "My Crazy Custom ThinkUp" <notifications@my_thinkup_hostname>/', $email_body);
     $config->setValue("app_title_prefix", "My Other Installation of ");
     $_SERVER['HTTP_HOST'] = null;
     $_SERVER['SERVER_NAME'] = "my_other_hostname";
     Mailer::mail('you@example.com', 'Testing 123', 'Me worky, yo?');
     $email_body = Mailer::getLastMail();
     $this->debug($email_body);
     $this->assertPattern('/From: "My Other Installation of ThinkUp" <notifications@my_other_hostname>/', $email_body);
     $config->setValue("app_title_prefix", "Yet Another Installation of ");
     $_SERVER['HTTP_HOST'] = null;
     $_SERVER['SERVER_NAME'] = null;
     $builder = FixtureBuilder::build('options', array('namespace' => 'application_options', 'option_name' => 'server_name', 'option_value' => 'testservername'));
     Mailer::mail('you@example.com', 'Testing 123', 'Me worky, yo?');
     $email_body = Mailer::getLastMail();
     $this->debug($email_body);
     $this->assertPattern('/From: "Yet Another Installation of ThinkUp" <notifications@testservername>/', $email_body);
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:25,代码来源:TestOfMailer.php


示例10: testInstanceMoreThan3Hours

 public function testInstanceMoreThan3Hours()
 {
     $instance_builder = FixtureBuilder::build('instances', array('crawler_last_run' => '-4h'));
     $controller = new CheckCrawlerController(true);
     $results = $controller->go();
     $this->assertEqual("Crawler hasn't run in 4 hours", $results, $results);
 }
开发者ID:rayyan,项目名称:ThinkUp,代码行数:7,代码来源:TestOfCheckCrawlerController.php


示例11: buildData

 private function buildData()
 {
     $owner_builder = FixtureBuilder::build('owners', array('id' => 1, 'email' => 'me@example.com', 'pwd' => 'XXX', 'is_activated' => 1));
     $instance_builder = FixtureBuilder::build('instances', array('id' => 1, 'network_username' => 'jack', 'network' => 'twitter'));
     $owner_instance_builder = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 1));
     return array($owner_builder, $instance_builder, $owner_instance_builder);
 }
开发者ID:rayyan,项目名称:ThinkUp,代码行数:7,代码来源:TestOfRSSController.php


示例12: testLoadConfigViewData

 public function testLoadConfigViewData()
 {
     $this->simulateLogin('me@example.com', true);
     $controller = new AppConfigController(true);
     $results = $controller->control();
     $json_obj = json_decode($results);
     //var_dump($json_obj);
     $this->assertFalse($json_obj->app_config_settings->recaptcha_enable->required);
     $this->assertEqual(count($json_obj->values), 0, 'no app settings stored');
     $bvalue = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'recaptcha_enable', 'option_value' => 'true');
     $bvalue2 = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'recaptcha_private_key', 'option_value' => 'abc123');
     $bvalue3 = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'recaptcha_public_key', 'option_value' => 'abc123public');
     $bvalue4 = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'default_instance', 'option_value' => '123');
     $bvalue5 = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'is_opted_out_usage_stats', 'option_value' => 'true');
     $bdata = FixtureBuilder::build('options', $bvalue);
     $bdata2 = FixtureBuilder::build('options', $bvalue2);
     $bdata3 = FixtureBuilder::build('options', $bvalue3);
     $bdata4 = FixtureBuilder::build('options', $bvalue4);
     $bdata5 = FixtureBuilder::build('options', $bvalue5);
     $results = $controller->control();
     $json_obj = json_decode($results);
     $this->assertFalse($json_obj->app_config_settings->recaptcha_enable->required);
     $this->assertTrue($json_obj->values->recaptcha_enable->option_value, "uses db config value");
     $this->assertEqual($json_obj->values->recaptcha_private_key->option_value, 'abc123');
     $this->assertEqual($json_obj->values->recaptcha_public_key->option_value, 'abc123public');
     $this->assertEqual($json_obj->values->default_instance->option_value, '123');
     $this->assertTrue($json_obj->values->is_opted_out_usage_stats->option_value);
 }
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:28,代码来源:TestOfAppConfigController.php


示例13: buildData

 protected function buildData()
 {
     $builders = array();
     $builders[] = FixtureBuilder::build('sessions', array('session_id' => 'foobar', 'updated' => date('c'), 'data' => serialize(array('foo' => 'bar'))));
     $builders[] = FixtureBuilder::build('sessions', array('session_id' => 'nofoo', 'updated' => date('c'), 'data' => serialize(array('blah' => 'baz'))));
     $builders[] = FixtureBuilder::build('sessions', array('session_id' => 'oldsession', 'updated' => date('c', time() - 200), 'data' => 'still here'));
     return $builders;
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:8,代码来源:TestOfSessionMySQLDAO.php


示例14: buildData

 protected function buildData()
 {
     $builders = array();
     $builders[] = FixtureBuilder::build('cookies', array('owner_email' => 'me@test.com', 'cookie' => 'chocolate'));
     $builders[] = FixtureBuilder::build('cookies', array('owner_email' => 'me@test.com', 'cookie' => 'gingersnap'));
     $builders[] = FixtureBuilder::build('cookies', array('owner_email' => 'you@test.com', 'cookie' => 'oreo'));
     return $builders;
 }
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:8,代码来源:TestOfCookieMySQLDAO.php


示例15: testOnlyOnce

 public function testOnlyOnce()
 {
     $insight_builder = FixtureBuilder::build('insights', array('id' => 30, 'instance_id' => $this->instance->id, 'slug' => 'twitter_age', 'date' => '-1d'));
     $plugin = new TwitterAgeInsight();
     $plugin->generateInsight($this->instance, $this->makeUser('2011-10-01'), array(), 1);
     $result = $this->insight_dao->getInsight('twitter_age', $this->instance->id, date('Y-m-d'));
     $this->assertNull($result);
 }
开发者ID:pepeleproso,项目名称:ThinkUp,代码行数:8,代码来源:TestOfTwitterAgeInsight.php


示例16: buildData

 private function buildData()
 {
     $owner_builder = FixtureBuilder::build('owners', array('id' => 1, 'email' => 'me@example.com'));
     $instance_builder = FixtureBuilder::build('instances', array('id' => 1, 'network_username' => 'someuser1', 'network' => 'twitter'));
     $instance1_builder = FixtureBuilder::build('instances', array('id' => 2, 'network_username' => 'someuser2', 'network' => 'twitter'));
     $owner_instance_builder = FixtureBuilder::build('owner_instances', array('instance_id' => 1, 'owner_id' => 1));
     return array($owner_builder, $instance_builder, $instance1_builder, $owner_instance_builder);
 }
开发者ID:rayyan,项目名称:ThinkUp,代码行数:8,代码来源:TestOfGridExportController.php


示例17: buildData

 protected function buildData()
 {
     $builders = array();
     // Add a photo to the database
     $builders[] = FixtureBuilder::build('posts', array('id' => 5, 'post_id' => '507648000295407216_180890738', 'author_user_id' => '180890738', 'author_username' => 'nilakshdas', 'author_fullname' => 'Nilaksh Das', 'author_avatar' => 'http://images.ak.instagram.com/profiles/profile_180890738_75sq_1374737148.jpg', 'post_text' => '#LoseYourself, as usual.', 'is_protected' => 0, 'source' => 'undefined', 'pub_date' => '2013-07-25 12:42:59', 'network' => 'instagram'));
     $builders[] = FixtureBuilder::build('photos', array('id' => 3, 'post_key' => 5, 'filter' => 'Lo-fi', 'standard_resolution_url' => 'http://distilleryimage0.s3.amazonaws.com/a2e8b5f0f4f911e2af6f22000a1f9a09_7.jpg', 'low_resolution_url' => 'http://distilleryimage0.s3.amazonaws.com/a2e8b5f0f4f911e2af6f22000a1f9a09_6.jpg', 'thumbnail_url' => 'http://distilleryimage0.s3.amazonaws.com/a2e8b5f0f4f911e2af6f22000a1f9a09_5.jpg'));
     return $builders;
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:8,代码来源:TestOfPhotoMySQLDAO.php


示例18: setUp

 public function setUp()
 {
     parent::setUp();
     $this->builders = self::buildData();
     //set up required Twitter plugin options
     $this->builders[] = FixtureBuilder::build('options', array('namespace' => 'plugin_options-1', 'option_name' => 'oauth_consumer_secret', 'option_value' => 'testconsumersecret'));
     $this->builders[] = FixtureBuilder::build('options', array('namespace' => 'plugin_options-1', 'option_name' => 'oauth_consumer_key', 'option_value' => 'testconsumerkey'));
 }
开发者ID:randi2kewl,项目名称:ThinkUp,代码行数:8,代码来源:WebTestOfDeleteInstance.php


示例19: buildData

 protected function buildData() {
     $builders = array();
     //Insert test data into test table
     $builders[] = FixtureBuilder::build('users', array('user_id'=>12, 'user_name'=>'jack',
     'full_name'=>'Jack Dorsey', 'avatar'=>'avatar.jpg', 'location'=>'San Francisco'));
     $this->logger = Logger::getInstance();
     return $builders;
 }
开发者ID:rkabir,项目名称:ThinkUp,代码行数:8,代码来源:TestOfUserErrorMySQLDAO.php


示例20: buildData

 protected function buildData()
 {
     for ($i = 0; $i < 3; $i++) {
         $content = "This is content string # {$i}";
         $builders[] = FixtureBuilder::build('stream_data', array('data' => $content, 'network' => 'twitter'));
     }
     return $builders;
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:8,代码来源:TestOfStreamDataMySQLDAO.php



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