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


PHP DataGenerator::generate方法代码示例

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


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

示例1: data

 public function data()
 {
     if ($this->method !== "POST") {
         return array("error" => "Sorry, this endpoint only accepts POST requests. Please see the help documentation.");
     }
     // validate the incoming JSON data to ensure its valid
     $error = Utils::validateJSON($this->rawRequest);
     if ($error) {
         return array("error" => ErrorCodes::API_INVALID_JSON, "error_details" => $error);
     }
     $json = @json_decode($this->rawRequest);
     // validate the JSON contains the appropriate settings for the Code
     $errors = $this->validateCoreSettings($json);
     if ($errors) {
         return $errors;
     }
     $errors = $this->validateDataTypeSettings($json);
     if ($errors) {
         return $errors;
     }
     $errors = $this->validateExportTypeSettings($json);
     if ($errors) {
         return $errors;
     }
     // okay! Now we generate whatever data was requested
     $gen = new DataGenerator(Constants::GEN_ENVIRONMENT_API, $json);
     $response = $gen->generate();
     if ($response["success"]) {
         return $response;
     }
 }
开发者ID:JaeHoYun,项目名称:generatedata,代码行数:31,代码来源:API.class.php

示例2: testGetPublishersByTracker

 function testGetPublishersByTracker()
 {
     $campaignId = 1;
     // Add a couple of campaign_trackers
     $doCampaignsTrackers = OA_Dal::factoryDO('campaigns_trackers');
     $doCampaignsTrackers->campaignid = $campaignId;
     $doCampaignsTrackers->trackerid = 1;
     $aCampaignTrackerId = DataGenerator::generate($doCampaignsTrackers, 2);
     $doBanners = OA_Dal::factoryDO('banners');
     $doBanners->campaignid = $campaignId;
     $doBanners->acls_updated = '2007-04-03 18:39:45';
     $bannerId = DataGenerator::generateOne($doBanners, true);
     // Add a couple of affiliates
     $aAffiliateId = DataGenerator::generate('affiliates', 2);
     $doZones = OA_Dal::factoryDO('zones');
     $doZones->affiliateid = $aAffiliateId[0];
     $zoneId = DataGenerator::generateOne($doZones);
     $doAddZoneAssoc = OA_Dal::factoryDO('ad_zone_assoc');
     $doAddZoneAssoc->zone_id = $zoneId;
     $doAddZoneAssoc->ad_id = $BannerId;
     $adZoneAssocId = DataGenerator::generateOne($doAddZoneAssoc);
     // Test the correct number of rows is returned.
     $expectedRows = 1;
     $rsAffiliates = $this->dalAffiliates->getPublishersByTracker($aCampaignTrackerId[0]);
     $rsAffiliates->find();
     $actualRows = $rsAffiliates->getRowCount();
     $this->assertEqual($actualRows, $expectedRows);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:28,代码来源:Affiliates.dal.test.php

示例3: testUpdateVariableCode

 function testUpdateVariableCode()
 {
     $this->varName = 'my_var';
     $this->defaultVarCode = "var {$this->varName} = escape(\\'%%" . strtoupper($this->varName) . "_VALUE%%\\')";
     // Create a tracker with default variableMethod
     $doTrackers = OA_Dal::factoryDO('trackers');
     $trackerId = DataGenerator::generateOne($doTrackers);
     $doVariables = OA_Dal::factoryDO('variables');
     $doVariables->trackerid = $trackerId;
     $doVariables->name = $this->varName;
     $doVariables->variablecode = $this->defaultVarCode;
     $aVariableIds = DataGenerator::generate($doVariables, 2);
     // JS
     $this->assertTrue($this->dalVariables->updateVariableCode($trackerId, DataObjects_Trackers::TRACKER_VARIABLE_METHOD_JS));
     $this->assertVariableCode($trackerId, DataObjects_Trackers::TRACKER_VARIABLE_METHOD_JS);
     // DOM
     $this->assertTrue($this->dalVariables->updateVariableCode($trackerId, DataObjects_Trackers::TRACKER_VARIABLE_METHOD_DOM));
     $this->assertVariableCode($trackerId, DataObjects_Trackers::TRACKER_VARIABLE_METHOD_DOM);
     // Custom
     $this->customCode = 'custom';
     $doVariables->variablecode = $this->customCode;
     $doVariables->whereAdd('1=1');
     $doVariables->update(DB_DATAOBJECT_WHEREADD_ONLY);
     $this->assertTrue($this->dalVariables->updateVariableCode($trackerId, DataObjects_Trackers::TRACKER_VARIABLE_METHOD_CUSTOM));
     $this->assertVariableCode($trackerId, DataObjects_Trackers::TRACKER_VARIABLE_METHOD_CUSTOM);
     // Default
     $this->assertTrue($this->dalVariables->updateVariableCode($trackerId));
     $this->assertVariableCode($trackerId);
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:29,代码来源:Variables.dal.test.php

示例4: testGetLinkedCampaigns

 public function testGetLinkedCampaigns()
 {
     $trackerId = 5;
     $nonexistentTrackerId = 999;
     // Create a some campaigns
     $numLinkedCampaigns = 2;
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $aCampaignIds = DataGenerator::generate($doCampaigns, $numLinkedCampaigns);
     // Create tracker links for them
     foreach ($aCampaignIds as $campaignId) {
         $doCampaignsTrackers = OA_Dal::factoryDO('campaigns_trackers');
         $doCampaignsTrackers->trackerid = $trackerId;
         $doCampaignsTrackers->campaignid = $campaignId;
         DataGenerator::generateOne($doCampaignsTrackers);
     }
     // Ad a campaign that is not linked.
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $campaignId = DataGenerator::generateOne($doCampaigns);
     $aLinkedCampaigns = $this->dalTrackers->getLinkedCampaigns($trackerId);
     $this->assertEqual($numLinkedCampaigns, count($aLinkedCampaigns));
     foreach ($aLinkedCampaigns as $campaignId => $campaign) {
         $this->assertIsA($campaign, 'DataObjects_Campaigns', "Object not of type DataObjects_Campaigns");
     }
     // Check for nonexist
     $aLinkedCampaigns = $this->dalTrackers->getLinkedCampaigns($nonexistentTrackerId);
     $this->assertEmpty($aLinkedCampaigns);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:27,代码来源:Trackers.dal.test.php

示例5: generateOne

 /**
  * Generate one record. Wrapper for: generate($do, 1, $generateParents)
  * Returns id of created record
  *
  * @static
  * @access public
  * @param DB_DataObjectCommon $do Either DataObject or table name (as string)
  * @param bool $generateParents   Generate parent records
  * @return int                    Id of created record
  * @see DB_DataObject::insert()
  */
 function generateOne($do, $generateParents = false)
 {
     if (!empty($this) && is_a($this, 'DataGenerator')) {
         $ids = $this->generate($do, 1, $generateParents);
     } else {
         $ids = DataGenerator::generate($do, 1, $generateParents);
     }
     return array_pop($ids);
 }
开发者ID:villos,项目名称:tree_admin,代码行数:20,代码来源:DataGenerator.php

示例6: DataGenerator

 function test_genericHtml_class()
 {
     // test the class implementation
     $oComponent =& OX_Component::factory('bannerTypeHtml', 'demoBannerTypeHtml', 'demoHtml');
     // common extension methods
     $this->_assertClass($oComponent, 'bannerTypeHtml', 'demoBannerTypeHtml', 'demoHtml');
     // plugin-specific methods
     $this->assertTrue(method_exists($oComponent, '_buildHtmlTemplate'), $sender . ' missing method _buildHtmlTemplate');
     $this->assertTrue(method_exists($oComponent, 'exportData'), $sender . ' missing method exportData');
     // generate test data
     $doBanners = OA_Dal::factoryDO('banners');
     $oDG = new DataGenerator();
     $oDG->setData('banners', array('ext_bannertype' => array($oComponent->getComponentIdentifier())));
     $aIds = $oDG->generate($doBanners, 5, false);
     $aFields = $aVariables = array();
     // test the processForm method
     // this method joins the banners and banners_demo tables
     // by creating a banners_demo record where
     // banners_demo.banners_demo_id = banners.bannerid
     foreach ($aIds as $i => $bannerId) {
         $aFields['description'] = 'description_' . $bannerId;
         $this->assertTrue($oComponent->processForm(true, $bannerId, $aFields, $aVariables));
         $doBannersDemo = OA_Dal::factoryDO('banners_demo');
         $doBannersDemo->banners_demo_id = $bannerId;
         $this->assertTrue($doBannersDemo->find(true));
         $this->assertEqual($doBannersDemo->banners_demo_desc, $aFields['description']);
     }
     // test the exportData method
     $aTables = $oComponent->exportData();
     $this->assertIsA($aTables, 'array');
     $this->assertEqual(count($aTables), 2);
     $prefix = $GLOBALS['_MAX']['CONF']['table']['prefix'];
     $pattern = '/' . $prefix . 'z_' . $oComponent->component . '[\\d]{8}_[\\d]{6}' . $prefix . 'banners/';
     $this->assertPattern($pattern, $aTables[0]);
     $pattern = '/' . $prefix . 'z_' . $oComponent->component . '[\\d]{8}_[\\d]{6}' . $prefix . 'banners_demo/';
     $this->assertPattern($pattern, $aTables[1]);
     $oDbh = OA_DB::singleton();
     $query = "SELECT * FROM " . $oDbh->quoteIdentifier($aTables[0]);
     $aResult = $oDbh->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
     foreach ($aResult as $i => $aFrom) {
         $this->assertEqual($aFrom['bannerid'], $aIds[$i]);
     }
     $query = "SELECT * FROM " . $oDbh->quoteIdentifier($aTables[1]);
     $aResult = $oDbh->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
     foreach ($aResult as $i => $aFrom) {
         $this->assertEqual($aFrom['banners_demo_id'], $aIds[$i]);
     }
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:48,代码来源:demoBannerTypeHtml.plg.test.php

示例7: testDeleteWhereOne

 function testDeleteWhereOne()
 {
     $this->oaTable->createTable('audit');
     $this->oaTable->createTable('acls');
     $dg = new DataGenerator();
     $dg->setData('acls', array('bannerid' => array(1, 2, 3), 'executionorder' => array(0, 0, 0, 1, 1, 1, 2, 2, 2)));
     $dg->generate('acls', 5);
     OA_DB_Sql::deleteWhereOne('acls', 'bannerid', 1);
     $doAcls = OA_Dal::factoryDO('acls');
     $doAcls->bannerid = 1;
     $doAcls->find();
     $this->assertEqual(0, $doAcls->getRowCount());
     $doAcls->bannerid = 2;
     $doAcls->find();
     $this->assertEqual(2, $doAcls->getRowCount());
     $aConf = $GLOBALS['_MAX']['CONF'];
     $this->oaTable->dropTable($aConf['table']['prefix'] . 'acls');
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:18,代码来源:Sql.tbl.test.php

示例8: testGetChannelsAndAffiliates

 function testGetChannelsAndAffiliates()
 {
     // Insert 2 channels
     $aData = array('acls_updated' => array('2007-04-04 17:27:33'));
     $dg = new DataGenerator();
     $dg->setData('channel', $aData);
     $aChannelId = $dg->generate('channel', 2, true);
     // Check the correct number of rows returned
     $expectedRows = 2;
     $rsChannel = $this->dalChannel->getChannelsAndAffiliates();
     $rsChannel->find();
     $actualRows = $rsChannel->getRowCount();
     $this->assertEqual($actualRows, $expectedRows);
     // Check each row has the correct number of fields
     $rsChannel->fetch();
     $aChannel = $rsChannel->export();
     $this->assertEqual(count($aChannel), 4);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:18,代码来源:Channel.dal.test.php

示例9: testInsert

 function testInsert()
 {
     $numTrackers = 2;
     $clientId = 7;
     // Prepare test data
     $doChannel = OA_Dal::factoryDO('channel');
     $doChannel->acls_updated = '2007-04-03 19:29:54';
     $channelId = DataGenerator::generateOne($doChannel, true);
     // Test non empty connection wondows
     $GLOBALS['_MAX']['CONF']['logging']['defaultImpressionConnectionWindow'] = 1000;
     $GLOBALS['_MAX']['CONF']['logging']['defaultClickConnectionWindow'] = 2000;
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->clientid = $clientId;
     $campaignId = DataGenerator::generateOne($doCampaigns);
     $this->assertNotEmpty($campaignId);
     $this->assertEqual($doCampaigns->viewwindow, 1000);
     $this->assertEqual($doCampaigns->clickwindow, 2000);
     $GLOBALS['_MAX']['CONF']['logging']['defaultImpressionConnectionWindow'] = '';
     $GLOBALS['_MAX']['CONF']['logging']['defaultClickConnectionWindow'] = '';
     // Add trackers
     $doTrackers = OA_Dal::factoryDO('trackers');
     $doTrackers->clientid = $clientId;
     $doTrackers->linkcampaigns = 't';
     $aTrackerId = DataGenerator::generate($doTrackers, $numTrackers, false);
     $doTrackers = OA_Dal::factoryDO('trackers');
     $doTrackers->linkcampaigns = 'f';
     DataGenerator::generateOne($doTrackers);
     // redundant one
     // Test that inserting new campaigns triggers to insert new campaigns_trackers (if exists)
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->clientid = $clientId;
     $campaignId = DataGenerator::generateOne($doCampaigns);
     $this->assertNotEmpty($campaignId);
     // Test that two campaign_trackers were inserted as well
     $doCampaigns_trackers = OA_Dal::factoryDO('campaigns_trackers');
     $doCampaigns_trackers->campaignid = $campaignId;
     $this->assertEqual($doCampaigns_trackers->count(), $numTrackers);
     // Delete any data which wasn't created by DataGenerator
     DataGenerator::cleanUp(array('campaigns', 'campaigns_trackers', 'trackers'));
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:40,代码来源:Campaigns.dal.test.php

示例10: testGetAclsByDataValueType

 function testGetAclsByDataValueType()
 {
     $type = 'Site:Channel';
     $bannerId = 1;
     $channelId = 1;
     // Test it returns empty set if no data exists
     $rsChannel = $this->dalAcls->getAclsByDataValueType($bannerId, $type);
     $rsChannel->reset();
     $this->assertEqual($rsChannel->getRowCount(), 0);
     // Generate acls, two of them with the same $bannerId
     $data = array('bannerid' => array($bannerId, $bannerId, 3), 'data' => array("{$channelId},2,3", '4,5,6', "{$channelId}"), 'executionorder' => array(1, 2, 3));
     $dg = new DataGenerator();
     $dg->setData('acls', $data);
     // Add test data
     $doAcls = OA_Dal::factoryDO('acls');
     $doAcls->type = $type;
     $dg->generate($doAcls, 3, true);
     // Test that $bannerId is in two sets
     $rsChannel = $this->dalAcls->getAclsByDataValueType($channelId, $type);
     $rsChannel->reset();
     $this->assertEqual($rsChannel->getRowCount(), 2);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:22,代码来源:Acls.dal.test.php

示例11: testDelete

 function testDelete()
 {
     $doZones = OA_Dal::factoryDO('zones');
     $doZones->append = '';
     $doZones->chain = '';
     DataGenerator::generate($doZones, $numZones1 = 2);
     // add few reduntant zones
     // Add our testing zone
     $zoneId = DataGenerator::generateOne('zones');
     // add appending zones
     $doZones = OA_Dal::factoryDO('zones');
     $doZones->appendtype = phpAds_ZoneAppendZone;
     $doZones->append = 'zone:' . $zoneId;
     $doZones->chain = '';
     $aZoneIdAppends = DataGenerator::generate($doZones, $numZonesAppened = 3);
     // add chained zones
     $doZones = OA_Dal::factoryDO('zones');
     $doZones->append = '';
     $doZones->chain = 'zone:' . $zoneId;
     $aZoneIdChained = DataGenerator::generate($doZones, $numZonesChained = 3);
     $doZones = OA_Dal::staticGetDO('zones', $zoneId);
     $ret = $doZones->delete();
     // delete
     $this->assertTrue($ret);
     $numAllZones = $numZones1 + $numZonesAppened + $numZonesChained;
     // check appended zones were cleaned up
     $doZones = OA_Dal::factoryDO('zones');
     $doZones->append = '';
     //$doZones->whereAdd("append = ''");
     // $countWhat = true
     $this->assertEqual($doZones->count(), $numAllZones);
     // check chained zones were cleaned up
     $doZones = OA_Dal::factoryDO('zones');
     $doZones->chain = '';
     $this->assertEqual($doZones->count(), $numAllZones);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:36,代码来源:Zones.dal.test.php

示例12: __construct


//.........这里部分代码省略.........
             } else {
                 if (Core::$user->isAnonymousAdmin()) {
                     $this->response["success"] = false;
                     $this->response["errorCode"] = ErrorCodes::INVALID_REQUEST;
                 } else {
                     $accountID = $this->post["accountID"];
                     $this->response = Core::$user->updateAccount($accountID, $this->post);
                 }
             }
             break;
         case "saveConfiguration":
             Core::init();
             $response = Core::$user->saveConfiguration($this->post);
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["message"];
             if (isset($response["lastUpdated"])) {
                 $this->response["lastUpdated"] = $response["lastUpdated"];
             }
             break;
         case "copyDataSet":
             Core::init();
             $response = Core::$user->copyConfiguration($this->post);
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["message"];
             break;
         case "deleteDataSets":
             Core::init();
             $configurationIDs = $this->post["configurationIDs"];
             $response = Core::$user->deleteConfigurations($configurationIDs);
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["message"];
             break;
         case "saveDataSetVisibilityStatus":
             Core::init();
             $configurationID = $this->post["configurationID"];
             $status = $this->post["status"];
             $time = $this->post["time"];
             $response = Core::$user->saveDataSetVisibilityStatus($configurationID, $status, $time);
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["message"];
             if (isset($response["newStatus"])) {
                 $this->response["newStatus"] = $response["newStatus"];
             }
             break;
         case "getPublicDataSet":
             Core::init();
             $configurationID = $this->post["dataSetID"];
             $response = Core::$user->getPublicDataSet($configurationID);
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["message"];
             break;
         case "getDataSetHistory":
             Core::init();
             $configurationID = $this->post["dataSetID"];
             $response = Core::$user->getDataSetHistory($configurationID);
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["message"];
             break;
         case "login":
             Core::init();
             $email = $this->post["email"];
             $password = $this->post["password"];
             $response = Account::login($email, $password);
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["message"];
             break;
         case "logout":
             Core::init();
             if (!Core::checkIsLoggedIn()) {
                 $this->response["success"] = true;
             } else {
                 if (!Core::$user->isAnonymousAdmin()) {
                     Core::$user->logout();
                     $this->response["success"] = true;
                 }
             }
             break;
         case "resetPassword":
             Core::init();
             $email = $this->post["email"];
             $response = Account::resetPassword($email);
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["message"];
             break;
             // ------------------------------------------------------------------------------------
             // DATA GENERATION
             // ------------------------------------------------------------------------------------
         // ------------------------------------------------------------------------------------
         // DATA GENERATION
         // ------------------------------------------------------------------------------------
         case "generateInPage":
             Core::init("generation");
             $gen = new DataGenerator(Constants::GEN_ENVIRONMENT_POST, $this->post);
             $response = $gen->generate();
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["content"];
             $this->response["isComplete"] = $response["isComplete"];
             break;
     }
 }
开发者ID:ricardo-neves,项目名称:generatedata,代码行数:101,代码来源:AjaxRequest.class.php

示例13: _generateTestZones

 /**
  * A method to generate data for testing.
  *
  * @access private
  */
 function _generateTestZones($numZones)
 {
     $oNow = new Date();
     if (is_null($this->doZones)) {
         $this->doZones = OA_Dal::factoryDO('zones');
     }
     return DataGenerator::generate($this->doZones, $numZones);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:13,代码来源:Priority_getZonesForecastsForAllZones.dal.test.php

示例14: testgetZonesForecasts

 /**
  * The method to test the getZonesForecasts() method.
  */
 function testgetZonesForecasts()
 {
     $this->_createTestData();
     $operationInterval = $GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'];
     $oDal = new OA_Dal_Maintenance_Priority();
     $oLowerDate = new Date('2007-09-16 12:00:00');
     $oUpperDate = new Date('2007-09-16 17:00:00');
     $lowerDateStr = $oLowerDate->format(self::DATE_TIME_FORMAT);
     $upperDateStr = $oUpperDate->format(self::DATE_TIME_FORMAT);
     $weeks = 2;
     // Test with bad input
     $badAgencyId = -1;
     $result = $oDal->getZonesForecasts($lowerDateStr, $upperDateStr);
     $expected = array();
     $this->assertEqual($result, $expected);
     // Test with data outside the range
     $oDate = new Date('2007-09-16 11:00:00');
     $operationIntervalId = OX_OperationInterval::convertDateToOperationIntervalID($oDate);
     $aDates = OX_OperationInterval::convertDateToOperationIntervalStartAndEndDates($oDate);
     $previousOIDate = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($oDate);
     $startDateStr = $aDates['start']->format(self::DATE_TIME_FORMAT);
     $endDateStr = $aDates['end']->format(self::DATE_TIME_FORMAT);
     $doDIA = OA_Dal::factoryDO('data_intermediate_ad');
     $aDIAs = DataGenerator::generate($doDIA, 1);
     $doDIA = OA_Dal::staticGetDO('data_intermediate_ad', $aDIAs[0]);
     $doDIA->date_time = $startDateStr;
     $doDIA->operation_interval = $operationInterval;
     $doDIA->zone_id = $this->zoneId1;
     $doDIA->ad_id = 1;
     $doDIA->impressions = 1000;
     $doDIA->update();
     $result = $oDal->getZonesForecasts($startDateStr, $endDateStr);
     $expected = array();
     $this->assertEqual($result, $expected);
     // Test with data inside the range
     $oDate = new Date('2007-09-16 13:00:00');
     $operationIntervalId = OX_OperationInterval::convertDateToOperationIntervalID($oDate);
     $aDates = OX_OperationInterval::convertDateToOperationIntervalStartAndEndDates($oDate);
     $previousOIDate = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($oDate);
     $startDateStr = $aDates['start']->format(self::DATE_TIME_FORMAT);
     $endDateStr = $aDates['end']->format(self::DATE_TIME_FORMAT);
     $aDIAs = DataGenerator::generate($doDIA, 1);
     $doDIA = OA_Dal::staticGetDO('data_intermediate_ad', $aDIAs[0]);
     $doDIA->date_time = $previousOIDate['start']->format(self::DATE_TIME_FORMAT);
     $doDIA->operation_interval = $operationInterval;
     $doDIA->zone_id = $this->zoneId1;
     $doDIA->ad_id = 1;
     $doDIA->impressions = 70;
     $doDIA->update();
     $result = $oDal->getZonesForecasts($startDateStr, $endDateStr);
     $expected = array($this->zoneId1 => 70);
     $this->assertEqual($result, $expected);
     // Test with more data from the same zone
     $oDate = new Date('2007-09-16 14:00:00');
     $operationIntervalId = OX_OperationInterval::convertDateToOperationIntervalID($oDate);
     $aDates = OX_OperationInterval::convertDateToOperationIntervalStartAndEndDates($oDate);
     $previousOIDate = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($oDate);
     $startDateStr = $aDates['start']->format(self::DATE_TIME_FORMAT);
     $endDateStr = $aDates['end']->format(self::DATE_TIME_FORMAT);
     $aDIAs = DataGenerator::generate($doDIA, 3);
     $doDIA = OA_Dal::staticGetDO('data_intermediate_ad', $aDIAs[0]);
     $doDIA->date_time = $previousOIDate['start']->format(self::DATE_TIME_FORMAT);
     $doDIA->operation_interval = $operationInterval;
     $doDIA->zone_id = $this->zoneId1;
     $doDIA->ad_id = 2;
     $doDIA->impressions = 90;
     $doDIA->update();
     $doDIA = OA_Dal::staticGetDO('data_intermediate_ad', $aDIAs[1]);
     $doDIA->date_time = $previousOIDate['start']->format(self::DATE_TIME_FORMAT);
     $doDIA->operation_interval = $operationInterval;
     $doDIA->zone_id = $this->zoneId1;
     $doDIA->ad_id = 4;
     $doDIA->impressions = 110;
     $doDIA->update();
     $doDIA = OA_Dal::staticGetDO('data_intermediate_ad', $aDIAs[2]);
     $doDIA->date_time = $previousOIDate['start']->format(self::DATE_TIME_FORMAT);
     $doDIA->operation_interval = $operationInterval;
     $doDIA->zone_id = $this->zoneId2;
     $doDIA->ad_id = 4;
     $doDIA->impressions = 15000;
     $doDIA->update();
     $result = $oDal->getZonesForecasts($startDateStr, $endDateStr);
     $expected = array($this->zoneId1 => 200, $this->zoneId2 => 15000);
     $this->assertEqual($result, $expected);
     DataGenerator::cleanUp();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:89,代码来源:Priority_getZonesForecasts.dal.test.php

示例15: DataGenerator

// Should we add the year to the title (eh: PyCon11 or PyCon2011 instead of PyCon?)
define("EVENT_ADD_YEAR_TO_TITLE", 10);
// 50% chance if the additional year added to the name is a full year (2011) instead of short year (11)
define("EVENT_ADD_FULLYEAR_TO_TITLE", 50);
// Percentage of anonymous comments on events
define("EVENT_COMMENT_IS_ANONYMOUS", 15);
// Percentage of anonymous comments on talks
define("TALK_COMMENT_IS_ANONYMOUS", 15);
// 5% of the comments are marked private
define("COMMENT_IS_PRIVATE", 5);
// Percentage of talks that is claimed
define("TALK_IS_CLAIMED", 75);
// Does the talk have multiple speakers
define("TALK_HAS_MULTIPLE_SPEAKERS", 20);
// Percentage of the talks that have slides associated with them
define("TALK_HAS_SLIDES", 35);
// Amount of claims that are still pending
define("TALK_SPEAKER_PENDING", 10);
// Percentage of talks that is claimed by a user that has registered through joind.in
define("TALK_IS_CLAIMED_BY_REGISTERED_USER", 75);
// Only 1 percent of the users is an admin
define("USER_IS_ADMIN", 1);
// 25% has a twitter account
define("USER_HAS_TWITTER", 25);
// ====================== NOTHING TO EDIT BELOW THIS POINT, MOVE ALONG ======================
require_once "generator_data.interface.php";
require_once "generator_data.class.php";
require_once "generator.class.php";
$gen = new DataGenerator(new Generator_Data());
echo $gen->generate();
exit;
开发者ID:asgrim,项目名称:joindin-api,代码行数:31,代码来源:generate.php


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