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


PHP DataGenerator::cleanUp方法代码示例

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


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

示例1: tearDown

 function tearDown()
 {
     DataGenerator::cleanUp();
     $this->oDeliveryCacheCommon->invalidateAll();
     // Restore cache storage plugin settings
     $this->aConf['delivery']['cacheStoragePlugin'] = $this->currentCacheStorageSettings;
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:7,代码来源:DeliveryCacheCommon.mol.test.php

示例2: testGetEcpmAgenciesIds

 /**
  * A method to test the getEcpmAgenciesIds method.
  */
 function testGetEcpmAgenciesIds()
 {
     $this->_generateTestData();
     $da = new OA_Dal_Maintenance_Priority();
     $ret = $da->getEcpmAgenciesIds();
     $this->assertEqual($this->aExpectedData, $ret);
     DataGenerator::cleanUp();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:11,代码来源:Priority_getEcpmAgenciesIds.dal.test.php

示例3: test_runScript

 function test_runScript()
 {
     $aExpectation = $this->_generateTestData();
     $oUpgrade = new OA_Upgrade();
     $oUpgrade->initDatabaseConnection();
     $this->assertTrue($oUpgrade->runScript('postscript_openads_upgrade_2.7.11-dev.php'));
     $this->_assertTestData($aExpectation);
     DataGenerator::cleanUp();
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:9,代码来源:postscript_openads_upgrade_2.7.11-dev.up.test.php

示例4: testGetCampaignsInfoByAgencyIdAndPriority

 /**
  * A method to test the getCampaignsInfoByAgencyId method.
  */
 function testGetCampaignsInfoByAgencyIdAndPriority()
 {
     list($agencyId1, $agencyId2) = $this->_generateAgencyCampaigns($priority = 4, 1);
     $da = new OA_Dal_Maintenance_Priority();
     // Test 1 getCampaignsInfoByAgencyId method.
     $ret = $da->getCampaignsInfoByAgencyIdAndPriority($agencyId1, $priority);
     $this->checkTestResults($ret, $this->firsCampaignId, $this->firsAdId);
     // Test 2 getCampaignsInfoByAgencyId method.
     $ret = $da->getCampaignsInfoByAgencyIdAndPriority($agencyId2, $priority);
     $this->checkTestResults($ret, $this->secondCampaignId, $this->secondAdId);
     DataGenerator::cleanUp();
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:15,代码来源:Priority_getCampaignsInfoByAgencyId.dal.test.php

示例5: testGetAgencyEcpmContractCampaignsDeliveriesToDate

 /**
  * Method to test the getAgencyEcpmContractCampaignsDeliveriesToDate method.
  *
  * Requirements:
  * Test 1: Test correct results are returned with no data.
  * Test 2: Test correct results are returned with single data entry.
  * Test 3: Test correct results are returned with multiple data entries.
  */
 function testGetAgencyEcpmContractCampaignsDeliveriesToDate()
 {
     $priority = 7;
     $oMaxDalMaintenance = new OA_Dal_Maintenance_Priority();
     list($agencyId1, $agencyId2) = $this->_commonTest($oMaxDalMaintenance, $priority);
     // Check that there are no results for agency 1 (when checking ecpm deliveries)
     $result = $oMaxDalMaintenance->getAgencyEcpmContractCampaignsDeliveriesToDate($agencyId1, $priority);
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 0);
     // Check that results for agency 2 are the same (when checking ecpm deliveries)
     $result = $oMaxDalMaintenance->getAgencyEcpmContractCampaignsDeliveriesToDate($agencyId2, $priority);
     $this->_testResult($result);
     DataGenerator::cleanUp();
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:22,代码来源:Priority_getAgencyCampaignsDeliveriesToDate.dal.test.php

示例6: testGetCampaigns

 /**
  * A method to test the getCampaigns method.
  */
 function testGetCampaigns()
 {
     /**
      * @TODO Locate where clean up doesn't happen before this test, and fix!
      */
     TestEnv::restoreEnv();
     $da = new OA_Dal_Maintenance_Priority();
     $this->_generateStatsOne();
     // Test 1 getCampaigns method.
     $ret = $da->getCampaigns();
     $this->assertTrue(is_array($ret));
     $this->assertTrue(count($ret) == 5);
     $campaign = $ret[0];
     $this->assertIsA($campaign, 'OX_Maintenance_Priority_Campaign');
     $this->assertEqual($campaign->id, 1);
     $this->assertEqual($campaign->impressionTargetTotal, 0);
     $this->assertEqual($campaign->clickTargetTotal, 400);
     $this->assertEqual($campaign->conversionTargetTotal, 0);
     $this->assertEqual($campaign->impressionTargetDaily, 0);
     $this->assertEqual($campaign->clickTargetDaily, 0);
     $this->assertEqual($campaign->conversionTargetDaily, 0);
     $this->assertEqual($campaign->priority, 3);
     // Test 2 getCampaignData method.
     $campaign = $da->getCampaignData(1);
     $this->assertTrue(is_array($campaign));
     $this->assertTrue(count($campaign) == 5);
     $this->assertTrue(array_key_exists('advertiser_id', $campaign));
     $this->assertTrue(array_key_exists('placement_id', $campaign));
     $this->assertTrue(array_key_exists('name', $campaign));
     $this->assertTrue(array_key_exists('status', $campaign));
     $this->assertTrue(array_key_exists('num_children', $campaign));
     // Test 3 getCampaignStats method.
     $ret = $da->getCampaignStats(1);
     $this->assertTrue(is_array($ret));
     $this->assertTrue(count($ret) == 9);
     $this->assertTrue(array_key_exists('advertiser_id', $ret));
     $this->assertTrue(array_key_exists('placement_id', $ret));
     $this->assertTrue(array_key_exists('name', $ret));
     $this->assertTrue(array_key_exists('status', $ret));
     $this->assertTrue(array_key_exists('num_children', $ret));
     $this->assertTrue(array_key_exists('sum_requests', $ret));
     $this->assertTrue(array_key_exists('sum_views', $ret));
     $this->assertTrue(array_key_exists('sum_clicks', $ret));
     $this->assertTrue(array_key_exists('sum_conversions', $ret));
     DataGenerator::cleanUp();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:49,代码来源:Priority_getCampaigns.dal.test.php

示例7: testUpdate

 function testUpdate()
 {
     // Insert an agency
     $doAgency = OA_Dal::factoryDO('agency');
     $agencyId = $doAgency->insert();
     // Update the agency
     $doAgency = OA_Dal::staticGetDO('agency', $agencyId);
     $doAgency->name = 'bar';
     $doAgency->contact = 'baz';
     $doAgency->email = 'quux';
     $doAgency->update();
     $doAgencyResult = OA_Dal::staticGetDO('agency', $agencyId);
     $this->assertTrue($doAgencyResult->getRowCount(), 1);
     $this->assertEqual($doAgencyResult->name, 'bar');
     $this->assertEqual($doAgencyResult->contact, 'baz');
     $this->assertEqual($doAgencyResult->email, 'quux');
     DataGenerator::cleanUp(array('agency'));
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:18,代码来源:Agency.dal.test.php

示例8: testUpdateEcpmPriorities

 /**
  * Method to test the updateEcpmPriorities method.
  */
 function testUpdateEcpmPriorities()
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $oDal = new OA_Dal_Maintenance_Priority();
     // set up ad_zone_assoc records
     $this->addAdZoneAssoc($adId1 = 1, $zoneId1 = 1, 0.1);
     $this->addAdZoneAssoc($adId1 = 1, $zoneId2 = 2, 0.2);
     $this->addAdZoneAssoc($adId2 = 2, $zoneId3 = 3, 0.3);
     $this->addAdZoneAssoc($adId4 = 4, $zoneId4 = 4, $priority44 = 0.4);
     $aData = array($adId1 => array($zoneId1 => $priority11 = 0.11, $zoneId2 => $priority12 = 0.12), $adId2 => array($zoneId3 => $priority23 = 0.23));
     $ret = $oDal->updateEcpmPriorities($aData);
     $this->assertTrue($ret);
     $this->checkPriority($adId1, $zoneId1, $priority11);
     $this->checkPriority($adId1, $zoneId2, $priority12);
     $this->checkPriority($adId2, $zoneId3, $priority23);
     // Check that this priority didn't change
     $this->checkPriority($adId4, $zoneId4, $priority44);
     DataGenerator::cleanUp();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:22,代码来源:Priority_updateEcpmPriorities.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: testUpdateCampaignsEcpms

 /**
  * Method to test the updateCampaignsEcpms method.
  */
 function testUpdateCampaignsEcpms()
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $oDal = new OA_Dal_Maintenance_Priority();
     $aOldEcpms = array('0.1', '0.2', '0.3', '0.4', '0.5');
     $aCampaignsIds = array();
     foreach ($aOldEcpms as $ecpm) {
         $aCampaignsEcpms[$this->addCampaign($ecpm)] = $ecpm;
     }
     $testCampaignId = $this->addCampaign($testEcpm = '0.9');
     foreach ($aCampaignsEcpms as $campaignId => $ecpm) {
         $aCampaignsEcpms[$campaignId] += '0.01';
     }
     // update eCPMs
     $oDal->updateCampaignsEcpms($aCampaignsEcpms);
     // test that ecpms were correctly updates
     foreach ($aCampaignsEcpms as $campaignId => $ecpm) {
         $this->checkEcpm($campaignId, $ecpm);
     }
     // test that existing ecpms weren't changed
     $this->checkEcpm($testCampaignId, $testEcpm);
     DataGenerator::cleanUp();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:26,代码来源:Priority_updateCampaignsEcpms.dal.test.php

示例11: testGetMaintenancePriorityLastRunInfo

 /**
  * Method to test the getMaintenancePriorityLastRunInfo method.
  *
  * Requirements:
  * Test 1: Test correct results are returned with no data.
  * Test 2: Test correct results are returned with single data entry.
  * Test 3: Test correct results are returned with multiple data entries.
  * Test 4: Test correct results are returned with multiple run types.
  */
 function testGetMaintenancePriorityLastRunInfo()
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $oDbh =& OA_DB::singleton();
     $oMaxDalMaintenance = new OA_Dal_Maintenance_Priority();
     // Test 1
     $result = $oMaxDalMaintenance->getMaintenancePriorityLastRunInfo(DAL_PRIORITY_UPDATE_ECPM);
     $this->assertFalse($result);
     // Test 2
     $oStartDate = new Date('2005-06-21 15:00:01');
     $oEndDate = new Date('2005-06-21 15:01:01');
     $oUpdatedTo = new Date('2005-06-21 15:59:59');
     $oMaxDalMaintenance->setMaintenancePriorityLastRunInfo($oStartDate, $oEndDate, $oUpdatedTo, DAL_PRIORITY_UPDATE_ECPM);
     $result = $oMaxDalMaintenance->getMaintenancePriorityLastRunInfo(DAL_PRIORITY_UPDATE_ECPM);
     $this->assertTrue(is_array($result));
     $this->assertEqual($result['updated_to'], '2005-06-21 15:59:59');
     $this->assertEqual($result['operation_interval'], $conf['maintenance']['operationInterval']);
     // Test 3
     $oStartDate = new Date('2005-06-21 14:00:01');
     $oEndDate = new Date('2005-06-21 14:01:01');
     $oUpdatedTo = new Date('2005-06-21 14:59:59');
     $oMaxDalMaintenance->setMaintenancePriorityLastRunInfo($oStartDate, $oEndDate, $oUpdatedTo, DAL_PRIORITY_UPDATE_ECPM);
     $result = $oMaxDalMaintenance->getMaintenancePriorityLastRunInfo(DAL_PRIORITY_UPDATE_ECPM);
     $this->assertTrue(is_array($result));
     $this->assertEqual($result['updated_to'], '2005-06-21 15:59:59');
     $this->assertEqual($result['operation_interval'], $conf['maintenance']['operationInterval']);
     $oStartDate = new Date('2005-06-21 16:00:01');
     $oEndDate = new Date('2005-06-21 16:01:01');
     $oUpdatedTo = new Date('2005-06-21 16:59:59');
     $oMaxDalMaintenance->setMaintenancePriorityLastRunInfo($oStartDate, $oEndDate, $oUpdatedTo, DAL_PRIORITY_UPDATE_ECPM);
     $result = $oMaxDalMaintenance->getMaintenancePriorityLastRunInfo(DAL_PRIORITY_UPDATE_ECPM);
     $this->assertTrue(is_array($result));
     $this->assertEqual($result['updated_to'], '2005-06-21 16:59:59');
     $this->assertEqual($result['operation_interval'], $conf['maintenance']['operationInterval']);
     // Test 4
     $result = $oMaxDalMaintenance->getMaintenancePriorityLastRunInfo(DAL_PRIORITY_UPDATE_PRIORITY_COMPENSATION);
     $this->assertFalse($result);
     DataGenerator::cleanUp(array('log_maintenance_priority'));
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:48,代码来源:Priority_MaintenancePriorityLastRunInfo.dal.test.php

示例12: 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

示例13: testDeleteUnverifiedUsers

 function testDeleteUnverifiedUsers()
 {
     DataGenerator::cleanUp();
     $doUsers = OA_Dal::factoryDO('users');
     $cExistingUsers = $doUsers->count();
     // this user was created recently
     $doUsers = OA_Dal::factoryDO('users');
     $date = new Date();
     $date->subtractSeconds(SECONDS_PER_DAY);
     $doUsers->date_created = $doUsers->formatDate($date);
     $this->createUser($doUsers);
     // this user was created over a month ago - should be deleted
     $overMonthAgoSeconds = 31 * SECONDS_PER_DAY;
     $doUsers = OA_Dal::factoryDO('users');
     $date->subtractSeconds($overMonthAgoSeconds);
     $doUsers->date_created = $doUsers->formatDate($date);
     $this->createUser($doUsers);
     // this was created over a month ago but is verified
     $doUsers = OA_Dal::factoryDO('users');
     $date = new Date();
     $date->subtractSeconds($overMonthAgoSeconds);
     $doUsers->date_created = $doUsers->formatDate($date);
     $doUsers->sso_user_id = 123;
     $this->createUser($doUsers);
     $doUsers = OA_Dal::factoryDO('users');
     $this->assertEqual($doUsers->count(), 3 + $cExistingUsers);
     $doUsers = OA_Dal::factoryDO('users');
     $doUsers->deleteUnverifiedUsers(28 * SECONDS_PER_DAY);
     // check if one record was deleted
     $doUsers = OA_Dal::factoryDO('users');
     $this->assertEqual($doUsers->count(), 2 + $cExistingUsers);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:32,代码来源:Users.dal.test.php

示例14: test_MAX_aclRecompileAll

 function test_MAX_aclRecompileAll()
 {
     DataGenerator::cleanUp(array('acls'));
     $doBanners = OA_Dal::factoryDO('banners');
     $bannerId = DataGenerator::generateOne($doBanners);
     $doAcls = OA_Dal::factoryDO('acls');
     $doAcls->bannerid = $bannerId;
     $doAcls->logical = 'and';
     $doAcls->type = 'Dummy:Dummy';
     $doAcls->comparison = '=~';
     $doAcls->data = '0,1';
     $doAcls->executionorder = 1;
     $aclsId1 = DataGenerator::generateOne($doAcls);
     $doAcls = OA_Dal::factoryDO('acls');
     $doAcls->bannerid = $bannerId;
     $doAcls->logical = 'and';
     $doAcls->type = 'Dummy:Dummy';
     $doAcls->comparison = '!~';
     $doAcls->data = 'openx.org';
     $doAcls->executionorder = 0;
     $aclsId2 = DataGenerator::generateOne($doAcls);
     $this->assertTrue(MAX_AclReCompileAll());
     $doBanners =& OA_Dal::staticGetDO('banners', $bannerId);
     $this->assertEqual("MAX_checkDummy_Dummy('openx.org', '!~') and MAX_checkDummy_Dummy('0,1', '=~')", $doBanners->compiledlimitation);
     $this->assertEqual("Dummy:Dummy", $doBanners->acl_plugins);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:26,代码来源:lib-acl.mol.test.php

示例15: testGetAdZoneAssociationsByAds

 /**
  * A method to test the getAdZoneAssociationsByAds method.
  *
  * Test 1: Test with bad input, and ensure that an empty array is retuend.
  * Test 2: Test with no data, and ensure that an empty array is returned.
  * Test 3: Test with one ad/zone link, and ensure the correct data is returned.
  * Test 4: Test with a more complex set of data.
  */
 function testGetAdZoneAssociationsByAds()
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $oDbh =& OA_DB::singleton();
     $oDal = new OA_Dal_Maintenance_Priority();
     // Test 1
     $result = $oDal->getAdZoneAssociationsByAds(1);
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 0);
     // Test 2
     $aAdIds = array(1);
     $result = $oDal->getAdZoneAssociationsByAds($aAdIds);
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 0);
     // Test 3
     $doZones = OA_Dal::factoryDO('zones');
     $zoneId = DataGenerator::generateOne($doZones, true);
     $doAdZone = OA_Dal::factoryDO('ad_zone_assoc');
     $doAdZone->ad_id = 1;
     $doAdZone->zone_id = $zoneId;
     $doAdZone->link_type = 1;
     $idAdZone = DataGenerator::generateOne($doAdZone);
     $aAdIds = array(1);
     $result = $oDal->getAdZoneAssociationsByAds($aAdIds);
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 1);
     $this->assertTrue(is_array($result[1]));
     $this->assertEqual(count($result[1]), 1);
     $this->assertTrue(is_array($result[1][0]));
     $this->assertEqual(count($result[1][0]), 1);
     $this->assertTrue(isset($result[1][0]['zone_id']));
     $this->assertEqual($result[1][0]['zone_id'], 1);
     DataGenerator::cleanUp();
     // Test 4
     $zoneId1 = DataGenerator::generateOne($doZones, true);
     $doAdZone->ad_id = 1;
     $doAdZone->zone_id = $zoneId1;
     $doAdZone->link_type = 1;
     $idAdZone = DataGenerator::generateOne($doAdZone);
     $zoneId2 = DataGenerator::generateOne($doZones, true);
     $doAdZone->ad_id = 1;
     $doAdZone->zone_id = $zoneId2;
     $doAdZone->link_type = 1;
     $idAdZone = DataGenerator::generateOne($doAdZone);
     $zoneId3 = DataGenerator::generateOne($doZones, true);
     $doAdZone->ad_id = 1;
     $doAdZone->zone_id = $zoneId3;
     $doAdZone->link_type = 1;
     $idAdZone = DataGenerator::generateOne($doAdZone);
     $doAdZone->ad_id = 2;
     $doAdZone->zone_id = $zoneId2;
     $doAdZone->link_type = 1;
     $idAdZone = DataGenerator::generateOne($doAdZone);
     $doAdZone->ad_id = 2;
     $doAdZone->zone_id = $zoneId3;
     $doAdZone->link_type = 0;
     $idAdZone = DataGenerator::generateOne($doAdZone);
     $zoneId = DataGenerator::generateOne($doZones, true);
     $doAdZone->ad_id = 3;
     $doAdZone->zone_id = $zoneId1;
     $doAdZone->link_type = 1;
     $idAdZone = DataGenerator::generateOne($doAdZone);
     $zoneId4 = DataGenerator::generateOne($doZones, true);
     $zoneId = DataGenerator::generateOne($doZones, true);
     $doAdZone->ad_id = 3;
     $doAdZone->zone_id = $zoneId4;
     $doAdZone->link_type = 1;
     $idAdZone = DataGenerator::generateOne($doAdZone);
     $aAdIds = array(1, 2, 3);
     $result = $oDal->getAdZoneAssociationsByAds($aAdIds);
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 3);
     $this->assertTrue(is_array($result[1]));
     $this->assertEqual(count($result[1]), 3);
     $this->assertTrue(is_array($result[1][0]));
     $this->assertEqual(count($result[1][0]), 1);
     $this->assertTrue(isset($result[1][0]['zone_id']));
     $this->assertEqual($result[1][0]['zone_id'], $zoneId1);
     $this->assertTrue(is_array($result[1][1]));
     $this->assertEqual(count($result[1][1]), 1);
     $this->assertTrue(isset($result[1][1]['zone_id']));
     $this->assertEqual($result[1][1]['zone_id'], $zoneId2);
     $this->assertTrue(is_array($result[1][2]));
     $this->assertEqual(count($result[1][2]), 1);
     $this->assertTrue(isset($result[1][2]['zone_id']));
     $this->assertEqual($result[1][2]['zone_id'], $zoneId3);
     $this->assertTrue(is_array($result[2]));
     $this->assertEqual(count($result[2]), 1);
     $this->assertTrue(is_array($result[2][0]));
     $this->assertEqual(count($result[2][0]), 1);
     $this->assertTrue(isset($result[2][0]['zone_id']));
     $this->assertEqual($result[2][0]['zone_id'], $zoneId2);
//.........这里部分代码省略.........
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:Priority_getAdZoneAssociationsByAds.dal.test.php


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