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


PHP OA_Dal::staticGetDO方法代码示例

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


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

示例1: testDuplicate

 function testDuplicate()
 {
     $GLOBALS['strCopyOf'] = 'Copy of ';
     $filename = 'test.gif';
     $doBanners = OA_Dal::factoryDO('banners');
     $doBanners->filename = $filename;
     $doBanners->storagetype = 'sql';
     $doBanners->acls_updated = '2007-04-03 19:28:06';
     $id1 = DataGenerator::generateOne($doBanners, true);
     $doBanners = OA_Dal::staticGetDO('banners', $id1);
     Mock::generatePartial('DataObjects_Banners', $mockBanners = 'DataObjects_Banners' . rand(), array('_imageDuplicate'));
     $doMockBanners = new $mockBanners($this);
     $doMockBanners->init();
     $doMockBanners->setFrom($doBanners);
     $doMockBanners->bannerid = $doBanners->bannerid;
     // setFrom() doesn't copy primary key
     $doMockBanners->setReturnValue('_imageDuplicate', $filename);
     // make sure image was duplicated as well
     $doMockBanners->expectOnce('_imageDuplicate');
     $id2 = $doMockBanners->duplicate();
     // duplicate
     $doMockBanners->tally();
     $this->assertNotEmpty($id2);
     $this->assertNotEqual($id1, $id2);
     $doBanners1 = OA_Dal::staticGetDO('banners', $id1);
     $doBanners2 = OA_Dal::staticGetDO('banners', $id2);
     // assert they are equal (but without comparing primary key)
     $this->assertNotEqualDataObjects($this->stripKeys($doBanners1), $this->stripKeys($doBanners2));
     // Test that the only difference is their description
     $doBanners1->description = $doBanners2->description = null;
     $this->assertEqualDataObjects($this->stripKeys($doBanners1), $this->stripKeys($doBanners2));
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:32,代码来源:Banners.dal.test.php

示例2:

 function &staticGetApi($createDefaultManager = true)
 {
     $oApi =& $GLOBALS['_STATIC']['staticGetApi'];
     if (empty($oApi)) {
         $doAccounts = OA_Dal::factoryDO('accounts');
         $doAccounts->account_type = OA_ACCOUNT_ADMIN;
         $adminAccountId = DataGenerator::generateOne($doAccounts);
         if ($createDefaultManager) {
             $doAgency = OA_Dal::factoryDO('agency');
             $doAgency->name = 'Default Manager';
             $agencyId = DataGenerator::generateOne($doAgency);
             $doAgency = OA_Dal::staticGetDO('agency', $agencyId);
             $managerAccountId = $doAgency->account_id;
         }
         $doUsers = OA_Dal::factoryDO('users');
         $doUsers->username = 'admin_' . md5(uniqid('', true));
         $doUsers->password = md5('secret');
         $doUsers->default_account_id = $createDefaultManager ? $managerAccountId : $adminAccountId;
         $userId = DataGenerator::generateOne($doUsers);
         $doAUA = OA_Dal::factoryDO('account_user_assoc');
         $doAUA->account_id = $adminAccountId;
         $doAUA->user_id = $userId;
         DataGenerator::generateOne($doAUA);
         $oApi = new Mocked_OA_Api_Xmlrpc($doUsers->username, 'secret');
     }
     return $oApi;
 }
开发者ID:akirsch,项目名称:revive-adserver,代码行数:27,代码来源:Common.api.php

示例3: linkCampaign

 /**
  * Links a campaign to the given tracker ID
  *
  * @param int $trackerId the ID of the tracker to link the campaign to.
  * @param int $campaignId the ID of the campaign to link to the tracker.
  * @param int $status optional connection status type, eg MAX_CONNECTION_STATUS_APPROVED. See constants.php.
  *                    if no status given, uses the tracker's default status.
  * @return boolean true on successful link, false on error.
  */
 public function linkCampaign($trackerId, $campaignId, $status = null)
 {
     // Check the ID's are valid.
     if (!$this->idExists('trackers', $trackerId) || !$this->idExists('campaigns', $campaignId)) {
         return false;
     }
     $doCampaignsTrackers = OA_Dal::factoryDO('campaigns_trackers');
     $doCampaignsTrackers->trackerid = $trackerId;
     $doCampaignsTrackers->campaignid = $campaignId;
     if ($doCampaignsTrackers->find()) {
         // Already linked.
         return true;
     }
     // Set the status
     if (!is_null($status)) {
         $doCampaignsTrackers->status = $status;
     } else {
         $oTracker = OA_Dal::staticGetDO('trackers', $trackerId);
         $doCampaignsTrackers->status = $oTracker->status;
     }
     if ($doCampaignsTrackers->insert()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:35,代码来源:Trackers.php

示例4: testUpdateWhereOne

 function testUpdateWhereOne()
 {
     $this->initTables(array('campaigns', 'trackers'));
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->campaignname = 'First';
     $doCampaigns->views = 10;
     $campaignId1 = DataGenerator::generateOne($doCampaigns);
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->campaignname = 'Third';
     $doCampaigns->views = 30;
     $campaignId2 = DataGenerator::generateOne($doCampaigns);
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->campaignname = 'Fifth';
     $doCampaigns->views = 50;
     $campaignId3 = DataGenerator::generateOne($doCampaigns);
     $cUpdated = OA_DB_Sql::updateWhereOne('campaigns', 'campaignid', $campaignId2, array('campaignname' => 'Second', 'views' => 20));
     $this->assertEqual(1, $cUpdated);
     $doCampaigns = OA_Dal::staticGetDO('campaigns', $campaignId2);
     $this->assertEqual('Second', $doCampaigns->campaignname);
     $this->assertEqual(20, $doCampaigns->views);
     $doCampaigns = OA_Dal::staticGetDO('campaigns', $campaignId1);
     $this->assertEqual('First', $doCampaigns->campaignname);
     $this->assertEqual('10', $doCampaigns->views);
     $aConf = $GLOBALS['_MAX']['CONF'];
     $this->oaTable->dropTable($aConf['table']['prefix'] . 'campaigns');
     $this->oaTable->dropTable($aConf['table']['prefix'] . 'trackers');
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:27,代码来源:Sql.tbl.test.php

示例5: testUpdate

 /**
  * Tests the timestamps are updated correctly.
  * 
  * Test 1: Tests the current timestamp is inserted for a new image.
  * Test 2: Tests the timestamp is updated when an image is updated.
  *
  */
 function testUpdate()
 {
     // Test 1
     // Get the start time of the test
     $start = time();
     sleep(1);
     // Insert an image
     $doImages = OA_Dal::factoryDO('images');
     $doImages->filename = 'foo.jpg';
     $doImages->contents = '';
     DataGenerator::generateOne($doImages);
     // Get the image out of the DB
     $doImages = OA_Dal::staticGetDO('images', 'filename', 'foo.jpg');
     // Check the timestamp is > time at start of test and <= current time
     // Deal with MySQL 4.0 timestamps
     if (preg_match('/^(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)$/', $doImages->t_stamp, $m)) {
         $doImages->t_stamp = "{$m[1]}-{$m[2]}-{$m[3]} {$m[4]}:{$m[5]}:{$m[6]}";
     }
     $actual = strtotime($doImages->t_stamp);
     $this->assertTrue($actual > $start && $actual <= time());
     // Test 2
     // Update the image
     $doImages->contents = '1';
     sleep(1);
     $doImages->update();
     // Get the image out of the DB
     $doImages = OA_Dal::staticGetDO('images', 'filename', 'foo.jpg');
     $oldTime = $actual;
     // Deal with MySQL 4.0 timestamps
     if (preg_match('/^(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)$/', $doImages->t_stamp, $m)) {
         $doImages->t_stamp = "{$m[1]}-{$m[2]}-{$m[3]} {$m[4]}:{$m[5]}:{$m[6]}";
     }
     $actual = strtotime($doImages->t_stamp);
     $this->assertTrue($actual > $oldTime && $actual <= time());
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:42,代码来源:Images.dal.test.php

示例6: getAdvertiserDetails

 /**
  * A method to retrieve all information about one advertiser from the database.
  *
  * @param int $advertiserId The advertiser ID.
  * @return mixed An associative array with a key for each database field,
  *               or null if no result found.
  *
  * @todo Consider deprecating this method in favour of an object approach.
  */
 function getAdvertiserDetails($advertiserId)
 {
     $doClients = OA_Dal::staticGetDO('clients', $advertiserId);
     if ($doClients) {
         return $doClients->toArray();
     }
     return null;
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:17,代码来源:Clients.php

示例7: testDuplicate

 function testDuplicate()
 {
     $GLOBALS['strCopyOf'] = 'Copy of ';
     //  create test channel
     $doChannel = OA_Dal::factoryDO('channel');
     $doChannel->acls_updated = '2007-04-03 19:29:54';
     $channelId = DataGenerator::generateOne($doChannel, true);
     //  create test acls
     $doAcls = OA_Dal::factoryDO('acls_channel');
     $doAcls->channelid = $channelId;
     $doAcls->type = 'Client:Ip';
     $doAcls->comparison = '==';
     $doAcls->data = '127.0.0.1';
     $doAcls->executionorder = 1;
     $doAcls->insert();
     $doAcls = OA_Dal::factoryDO('acls_channel');
     $doAcls->channelid = $channelId;
     $doAcls->type = 'Client:Domain';
     $doAcls->comparison = '==';
     $doAcls->data = 'example.com';
     $doAcls->executionorder = 2;
     $doAcls->insert();
     // duplicate
     $newChannelId = OA_Dal::staticDuplicate('channel', $channelId);
     // retrieve original and duplicate channel
     $doChannel = OA_Dal::staticGetDO('channel', $channelId);
     $doNewChannel = OA_Dal::staticGetDO('channel', $newChannelId);
     // assert they are not equal including primary keys - name column should not match
     $this->assertNotEqualDataObjects($this->stripKeys($doChannel), $this->stripKeys($doNewChannel));
     // assert they are equal excluding primary keys
     $doChannel->name = $doNewChannel->name = null;
     $this->assertEqualDataObjects($this->stripKeys($doChannel), $this->stripKeys($doNewChannel));
     //  retrieve acls for original and duplicate channel
     $doAcls = OA_Dal::factoryDO('acls_channel');
     $doAcls->channelid = $channelId;
     $doAcls->orderBy('executionorder');
     if ($doAcls->find()) {
         while ($doAcls->fetch()) {
             $aAcls[] = clone $doAcls;
         }
     }
     $doNewAcls = OA_Dal::factoryDO('acls_channel');
     $doNewAcls->channelid = $newChannelId;
     $doNewAcls->orderBy('executionorder');
     if ($doNewAcls->find()) {
         while ($doNewAcls->fetch()) {
             $aNewAcls[] = clone $doNewAcls;
         }
     }
     //  iterate through acls ensuring they were properly copied
     if ($this->assertEqual(count($aAcls), count($aNewAcls))) {
         for ($x = 0; $x < count($aAcls); $x++) {
             $this->assertNotEqual($aAcls[$x]->channelid, $aNewAcls[$x]->channelid);
             $this->assertEqualDataObjects($this->stripKeys($aAcls[$x]), $this->stripKeys($aNewAcls[$x]));
         }
     }
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:57,代码来源:Channel.dal.test.php

示例8: testDuplicate

 function testDuplicate()
 {
     // Insert a tracker with some default data.
     $doTrackers = OA_Dal::factoryDO('trackers');
     $doTrackers->trackername = 'foo';
     $doTrackers->clientid = 1;
     $doTrackers->clickwindow = 3600;
     $doTrackers->status = 4;
     $doTrackers->type = 1;
     $trackerId = DataGenerator::generateOne($doTrackers, true);
     // Insert a variable for the tracker
     $doVariables = OA_Dal::factoryDO('variables');
     $doVariables->trackerid = $trackerId;
     $doVariables->name = 'bar';
     $variableId = DataGenerator::generateOne($doVariables);
     // Link the tracker to a campaign
     $doCampaignTrackers = OA_Dal::factoryDO('campaigns_trackers');
     $doCampaignTrackers->campaignid = 1;
     $doCampaignTrackers->trackerid = $trackerId;
     $campaignTrackerId = DataGenerator::generateOne($doCampaignTrackers);
     // Duplicate the tracker
     $doTrackers = OA_Dal::staticGetDO('trackers', $trackerId);
     $newTrackerId = $doTrackers->duplicate();
     $this->assertNotEmpty($newTrackerId);
     // Get the two trackers
     $doNewTrackers = OA_Dal::staticGetDO('trackers', $newTrackerId);
     $this->assertTrue($doNewTrackers);
     $doTrackers = OA_Dal::staticGetDO('trackers', $trackerId);
     $this->assertTrue($doTrackers);
     // Assert the trackers are not equal, excluding the primary key
     $this->assertNotEqualDataObjects($this->stripKeys($doTrackers), $this->stripKeys($doNewTrackers));
     // Assert the only difference in the trackers is their description
     $doTrackers->trackername = $doNewTrackers->trackername = null;
     $this->assertEqualDataObjects($this->stripKeys($doTrackers), $this->stripKeys($doNewTrackers));
     // Get the two variables
     $doNewVariables = OA_Dal::staticGetDO('variables', 'trackerid', $newTrackerId);
     $this->assertTrue($doNewVariables);
     $doVariables = OA_Dal::staticGetDO('variables', $variableId);
     $this->assertTrue($doVariables);
     // Assert the variables are not equal, excluding the primary key
     $this->assertNotEqualDataObjects($this->stripKeys($doVariables), $this->stripKeys($doNewVariables));
     // Assert the only difference in the variables is the trackers they are attached to
     $doVariables->trackerid = $doNewVariables->trackerid = null;
     $this->assertEqualDataObjects($this->stripKeys($doVariables), $this->stripKeys($doNewVariables));
     // Get the two campaign tracker links
     $doNewCampaignTrackers = OA_Dal::staticGetDO('campaigns_trackers', 'trackerid', $newTrackerId);
     $this->assertTrue($doNewCampaignTrackers);
     $doCampaignTrackers = OA_Dal::staticGetDO('campaigns_trackers', $campaignTrackerId);
     $this->assertTrue($doCampaignTrackers);
     // Assert the campaign trackers are not equal, excluding the primary key
     $this->assertNotEqualDataObjects($this->stripKeys($doCampaignTrackers), $this->stripKeys($doNewCampaignTrackers));
     // Assert the only difference in the campaign trackers is the trackers they are attached to
     $doCampaignTrackers->trackerid = $doNewCampaignTrackers->trackerid = null;
     $this->assertEqualDataObjects($this->stripKeys($doCampaignTrackers), $this->stripKeys($doNewCampaignTrackers));
     DataGenerator::cleanUp(array('campaigns', 'campaigns_trackers', 'trackers', 'variables'));
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:56,代码来源:Trackers.dal.test.php

示例9: OA_HeaderNavigation

function OA_HeaderNavigation()
{
    global $agencyid;
    if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
        phpAds_PageHeader("agency-access");
        $doAgency = OA_Dal::staticGetDO('agency', $agencyid);
        MAX_displayInventoryBreadcrumbs(array(array("name" => $doAgency->name)), "agency");
    } else {
        phpAds_PageHeader("agency-user");
    }
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:11,代码来源:agency-user.php

示例10: getLogoutUrl

 /**
  * If the agency has set the logout URL in a database, returns this URL
  * (trimmed).
  * Otherwise, returns 'index.php'.
  *
  * @param string $agencyId
  * @return string Url for redirection after logout.
  */
 function getLogoutUrl($agencyId)
 {
     $doAgency = null;
     if ($agencyId) {
         $doAgency = OA_Dal::staticGetDO('agency', $agencyId);
     }
     if ($doAgency && !empty($doAgency->logout_url)) {
         return trim($doAgency->logout_url);
     }
     return MAX::constructURL(MAX_URL_ADMIN, 'index.php');
 }
开发者ID:villos,项目名称:tree_admin,代码行数:19,代码来源:Agency.php

示例11: storeSerializedSession

 /**
  * @param string $serialized_session_data
  * @param string $session_id
  *
  * @todo Use ANSI SQL syntax, such as an UPDATE/INSERT cycle.
  * @todo Push down REPLACE INTO into a MySQL-specific DAL.
  */
 function storeSerializedSession($serialized_session_data, $session_id)
 {
     $doSession = OA_Dal::staticGetDO('session', $session_id);
     if ($doSession) {
         $doSession->sessiondata = $serialized_session_data;
         $doSession->update();
     } else {
         $doSession = OA_Dal::factoryDO('session');
         $doSession->sessionid = $session_id;
         $doSession->sessiondata = $serialized_session_data;
         $doSession->insert();
     }
 }
开发者ID:villos,项目名称:tree_admin,代码行数:20,代码来源:Session.php

示例12: testAddConversion

 function testAddConversion()
 {
     $day = '2007-04-04';
     $hour = 17;
     $total_basket_value = 100.0;
     $creative_id = 4;
     $zone_id = 5;
     $bannerId = $this->aIds['banners'][0];
     $dataIntermediateAdId = $this->aIds['dataIA'][0];
     $result = $this->dalData_intermediate_ad->addConversion('+', $basketValue = 12, $numItems = 4, $bannerId, $creative_id, $zone_id, $day, $hour);
     $doData_intermediate_ad = OA_Dal::staticGetDO('data_intermediate_ad', $dataIntermediateAdId);
     $this->assertEqual($doData_intermediate_ad->total_basket_value, $total_basket_value + $basketValue);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:13,代码来源:Data_intermediate_ad.dal.test.php

示例13: testStaticGetDO

 function testStaticGetDO()
 {
     // create test record
     $doBanners = OA_Dal::factoryDO('banners');
     $doBanners->acls_updated = '2007-04-03 20:41:33';
     $bannerId = DataGenerator::generateOne($doBanners);
     // Test that we retreived that record from database
     $doBanners = OA_Dal::staticGetDO('banners', $bannerId);
     $this->assertIsA($doBanners, 'DataObjects_Banners');
     $this->assertEqual($doBanners->bannerid, $bannerId);
     // Test that false is returned if record doesn't exist
     $doBanners = OA_Dal::staticGetDO('banners', $id = 123);
     $this->assertFalse($doBanners);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:14,代码来源:Dal.dal.test.php

示例14: testClearIntermediateAndSummaryTables

 function testClearIntermediateAndSummaryTables()
 {
     $oStartDate = new Date('2006-05-09 13:00:00');
     $oEndDate = new Date('2006-05-09 13:59:59');
     $aTestDates = array(1 => array('start' => new Date('2006-05-09 13:10:00'), 'end' => new Date('2006-05-09 13:14:59')), 2 => array('start' => new Date('2006-05-09 12:00:00'), 'end' => new Date('2006-05-09 12:59:59')), 3 => array('start' => new Date('2006-05-09 13:55:00'), 'end' => new Date('2006-05-09 12:59:59')));
     // Create some test data
     foreach ($aTestDates as $key => $aDates) {
         $doIntermediateAdConnection = OA_Dal::factoryDO('data_intermediate_ad_connection');
         $doIntermediateAdConnection->tracker_date_time = $aDates['start']->format('%Y-%m-%d %H:%M:%S');
         $aIntermediateAdConnectionId[$key] = DataGenerator::generateOne($doIntermediateAdConnection);
         $doDataIntermediateAdVariableValue = OA_Dal::factoryDO('data_intermediate_ad_variable_value');
         $doDataIntermediateAdVariableValue->data_intermediate_ad_connection_id = $aIntermediateAdConnectionId[$key];
         $aDataIntermediateAdVariableValueId[$key] = DataGenerator::generateOne($doDataIntermediateAdVariableValue);
         $doDataIntermediateAd = OA_Dal::factoryDO('data_intermediate_ad');
         $doDataIntermediateAd->interval_start = $aDates['start']->format('%Y-%m-%d %H:%M:%S');
         $doDataIntermediateAd->interval_end = $aDates['end']->format('%Y-%m-%d %H:%M:%S');
         $aDataIntermediateAdId[$key] = DataGenerator::generateOne($doDataIntermediateAd);
         $doDataSummaryAdHourly = OA_Dal::factoryDO('data_summary_ad_hourly');
         $doDataSummaryAdHourly->date_time = $aDates['start']->format('%Y-%m-%d %H:00:00');
         $aDataSummaryAdHourlyId[$key] = DataGenerator::generateOne($doDataSummaryAdHourly);
         $doDataSummaryAdZoneAssoc = OA_Dal::factoryDO('data_summary_ad_zone_assoc');
         $doDataSummaryAdZoneAssoc->interval_start = $aDates['start']->format('%Y-%m-%d %H:%M:%S');
         $doDataSummaryAdZoneAssoc->interval_end = $aDates['end']->format('%Y-%m-%d %H:%M:%S');
         $aDataSummaryAdZoneAssocId[$key] = DataGenerator::generateOne($doDataSummaryAdZoneAssoc);
     }
     OA_Maintenance_Regenerate::clearIntermediateAndSummaryTables($oStartDate, $oEndDate);
     // Check if proper rows was deleted
     foreach ($aIntermediateAdConnectionId as $key => $intermediateAdConnectionId) {
         $adoIntermediateAdConnection[$key] = OA_Dal::staticGetDO('data_intermediate_ad_connection', $aIntermediateAdConnectionId[$key]);
         $adoDataIntermediateAdVariableValue[$key] = OA_Dal::staticGetDO('data_intermediate_ad_variable_value', $aDataIntermediateAdVariableValueId[$key]);
         $adoDataIntermediateAd[$key] = OA_Dal::staticGetDO('data_intermediate_ad', $aDataIntermediateAdId[$key]);
         $adoDataSummaryAdHourly[$key] = OA_Dal::staticGetDO('data_summary_ad_hourly', $aDataSummaryAdHourlyId[$key]);
         $adoDataSummaryAdZoneAssoc[$key] = OA_Dal::staticGetDO('data_summary_ad_zone_assoc', $aDataSummaryAdZoneAssocId[$key]);
     }
     $this->assertFalse($adoIntermediateAdConnection[1]);
     $this->assertFalse($adoDataIntermediateAdVariableValue[1]);
     $this->assertFalse($adoDataIntermediateAd[1]);
     $this->assertFalse($adoDataSummaryAdHourly[1]);
     $this->assertFalse($adoDataSummaryAdZoneAssoc[1]);
     $this->assertNotNull($adoIntermediateAdConnection[2]);
     $this->assertNotNull($adoDataIntermediateAdVariableValue[2]);
     $this->assertNotNull($adoDataIntermediateAd[2]);
     $this->assertNotNull($adoDataSummaryAdHourly[2]);
     $this->assertNotNull($adoDataSummaryAdZoneAssoc[2]);
     $this->assertFalse($adoIntermediateAdConnection[3]);
     $this->assertFalse($adoDataIntermediateAdVariableValue[3]);
     $this->assertFalse($adoDataIntermediateAd[3]);
     $this->assertFalse($adoDataSummaryAdHourly[3]);
     $this->assertFalse($adoDataSummaryAdZoneAssoc[3]);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:50,代码来源:Regenerate.mtc.test.php

示例15: testBelongsToAccount

 function testBelongsToAccount()
 {
     OA_Dal::factoryDO('banners');
     // Initialise the class so it can be mocked.
     Mock::generatePartial('DataObjects_Banners', $mockBanners = 'DataObjects_Banners' . rand(), array('getOwningAccountIds'));
     $doMockBanners = new $mockBanners($this);
     $doMockBanners->init();
     $clientId = DataGenerator::generateOne('clients', true);
     $doClients = OA_Dal::staticGetDO('clients', $clientId);
     $agencyId = $doClients->agencyid;
     $accountId = $doClients->account_id;
     $doAgency = OA_Dal::staticGetDO('agency', $agencyId);
     $managerId = $doAgency->account_id;
     $dg = new DataGenerator();
     $dg->setData('campaigns', array('clientid' => array($clientId)));
     $doMockBanners->setReturnValue('getOwningAccountIds', array(OA_ACCOUNT_MANAGER => $managerId, OA_ACCOUNT_ADVERTISER => $accountId));
     $this->enableAuditing(true);
     $bannerId = $dg->generateOne($doMockBanners, true);
     $this->enableAuditing(false);
     $doAudit = OA_Dal::factoryDO('audit');
     $doAudit->context = 'banners';
     $doAudit->contextid = $bannerId;
     $this->assertTrue($doAudit->find(true));
     $this->assertTrue($doAudit->belongsToAccount($accountId, false));
     // generate different audit on campaign
     $dg = new DataGenerator();
     $doMockBanners = new $mockBanners($this);
     $doMockBanners->init();
     $clientId2 = DataGenerator::generateOne('clients', true);
     $doClients = OA_Dal::staticGetDO('clients', $clientId2);
     $agencyId2 = $doClients->agencyid;
     $accountId2 = $doClients->account_id;
     $doAgency = OA_Dal::staticGetDO('agency', $agencyId2);
     $managerId2 = $doAgency->account_id;
     $dg->setData('campaigns', array('clientid' => array($clientId2)));
     $doMockBanners->setReturnValue('getOwningAccountIds', array(OA_ACCOUNT_MANAGER => $managerId2, OA_ACCOUNT_ADVERTISER => $accountId2));
     $this->enableAuditing(true);
     $bannerId2 = $dg->generateOne($doMockBanners, true);
     $this->enableAuditing(false);
     $doAudit = OA_Dal::factoryDO('audit');
     $doAudit->context = 'banners';
     $doAudit->contextid = $bannerId2;
     $this->assertTrue($doAudit->find(true));
     $this->assertTrue($doAudit->belongsToAccount($accountId2, false));
     $this->assertFalse($doAudit->belongsToAccount($accountId, false));
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:46,代码来源:Audit.dal.test.php


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