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


PHP TestEnv类代码示例

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


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

示例1: test_runScript

 function test_runScript()
 {
     $GLOBALS['_MAX']['CONF']['table']['prefix'] = $this->prefix;
     $oUpgrade = new OA_Upgrade();
     $oUpgrade->initDatabaseConnection();
     $oDbh =& $oUpgrade->oDbh;
     $oTable = new OA_DB_Table();
     $testfile = MAX_PATH . "/etc/changes/tests/data/schema_tables_core_dashboard.xml";
     $oTable->init($testfile);
     $table = 'preference';
     $aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
     if (in_array($this->prefix . $table, $aExistingTables)) {
         $this->assertTrue($oTable->dropTable($this->prefix . $table), 'error dropping ' . $this->prefix . $table);
     }
     $this->assertTrue($oTable->createTable($table), 'error creating ' . $this->prefix . $table);
     $aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
     $this->assertTrue(in_array($this->prefix . $table, $aExistingTables), $this->prefix . $table . ' table not found');
     $this->assertTrue($oUpgrade->runScript('postscript_openads_upgrade_2.3.36-beta-rc1.php'));
     $aExistingColumns = $oDbh->manager->listTableFields($this->prefix . $table);
     $aColumns = array('ad_clicks_sum', 'ad_views_sum', 'ad_clicks_per_second', 'ad_views_per_second', 'ad_cs_data_last_sent', 'ad_cs_data_last_sent', 'ad_cs_data_last_received');
     foreach ($aColumns as $column) {
         $this->assertFalse(in_array($column, $aExistingColumns, $column . ' found in column list'));
     }
     TestEnv::restoreConfig();
     TestEnv::restoreEnv();
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:26,代码来源:postscript_openads_upgrade_2.3.36-beta-rc1.up.test.php

示例2: tearDown

 function tearDown()
 {
     // Uninstall the openXDeliveryLog plugin
     TestEnv::uninstallPluginPackage('openXDeliveryLimitations', false);
     // Clean up the testing environment
     TestEnv::restoreEnv();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:7,代码来源:PriorityBannerLimitations.mpe.test.php

示例3: tearDown

 function tearDown()
 {
     if (file_exists(MAX_PATH . '/var/' . OX_getHostName() . '.conf.php')) {
         @unlink(MAX_PATH . '/var/' . OX_getHostName() . '.conf.php');
     }
     $_SERVER['HTTP_HOST'] = $this->host;
     // Resume normal service with regards to the configuration file writer...
     unset($GLOBALS['override_TEST_ENVIRONMENT_RUNNING']);
     TestEnv::restoreConfig();
     parent::tearDown();
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:11,代码来源:migration_tables_core_603.mig.test.php

示例4: testGetDeliveredEcpmCampainImpressionsByAgency

 function testGetDeliveredEcpmCampainImpressionsByAgency()
 {
     $this->aIds2 = TestEnv::loadData('data_intermediate_ad_002');
     $impressions = 123;
     $agencyId = $this->aIds2['agency'][0];
     $campaignId = $this->aIds2['campaigns'][0];
     $day = '2007-04-04';
     $oDate = new Date($day . '00:00:00');
     $aDelivered = $this->dalData_intermediate_ad->getDeliveredEcpmCampainImpressionsByAgency($agencyId, $oDate);
     $howMany = 2;
     $this->assertEqual($aDelivered[$campaignId], $howMany * $impressions);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:12,代码来源:Data_intermediate_ad.dal.test.php

示例5: testGetRawBucketProcessingStrategy

 /**
  * The method to test the factory's getRawBucketProcessingStrategy()
  * methiod.
  */
 function testGetRawBucketProcessingStrategy()
 {
     $aConf =& $GLOBALS['_MAX']['CONF'];
     // Test the creation of an edge/aggregate server MySQL strategy class
     $aConf['lb']['enabled'] = true;
     $aConf['database']['type'] = 'mysql';
     $oProcessingStrategy = OX_Extension_DeliveryLog_BucketProcessingStrategyFactory::getRawBucketProcessingStrategy($aConf['database']['type']);
     $this->assertTrue(is_a($oProcessingStrategy, 'OX_Extension_DeliveryLog_RawBucketProcessingStrategyMysql'));
     $aConf['database']['type'] = 'pgsql';
     $oProcessingStrategy = OX_Extension_DeliveryLog_BucketProcessingStrategyFactory::getRawBucketProcessingStrategy($aConf['database']['type']);
     $this->assertTrue(is_a($oProcessingStrategy, 'OX_Extension_DeliveryLog_RawBucketProcessingStrategyPgsql'));
     // Restore the configuration file
     TestEnv::restoreConfig();
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:18,代码来源:BucketProcessingStrategyFactory.plg.test.php

示例6: test_MAX_Delivery_log_logVariableValues

 /**
  * A method to test the MAX_Delivery_log_logVariableValues() function.
  */
 function test_MAX_Delivery_log_logVariableValues()
 {
     $aConf =& $GLOBALS['_MAX']['CONF'];
     $aConf['maintenance']['operationInterval'] = 60;
     $GLOBALS['_MAX']['NOW'] = time();
     $oNowDate = new Date($GLOBALS['_MAX']['NOW']);
     // Test to ensure that the openXDeliveryLog plugin's data bucket
     // table does not exist
     $oTable = new OA_DB_Table();
     $tableExists = $oTable->extistsTable($aConf['table']['prefix'] . 'data_bkt_a_var');
     $this->assertFalse($tableExists);
     // Test calling the main logging function without any plugins installed,
     // to ensure that this does not result in any kind of error
     $aVariables = array(55 => array('variable_id' => 55, 'tracker_id' => 1, 'name' => 'fooVar', 'type' => 'string', 'variablecode' => ''), 66 => array('variable_id' => 66, 'tracker_id' => 1, 'name' => 'barVar', 'type' => 'string', 'variablecode' => ''));
     $_GET['fooVar'] = 'foo';
     $_GET['barVar'] = 'bar';
     MAX_Delivery_log_logVariableValues($aVariables, 1, 1, 'singleDB');
     // Install the openXDeliveryLog plugin
     TestEnv::installPluginPackage('openXDeliveryLog', false);
     // Test to ensure that the openXDeliveryLog plugin's data bucket
     // table now does exist
     $tableExists = $oTable->extistsTable($aConf['table']['prefix'] . 'data_bkt_a_var');
     $this->assertTrue($tableExists);
     // Ensure that there are is nothing logged in the data bucket table
     $doData_bkt_a_var = OA_Dal::factoryDO('data_bkt_a_var');
     $doData_bkt_a_var->find();
     $rows = $doData_bkt_a_var->getRowCount();
     $this->assertEqual($rows, 0);
     // Call the variable value logging function
     MAX_Delivery_log_logVariableValues($aVariables, 1, 1, 'singleDB');
     // Ensure that the data was logged correctly
     $doData_bkt_a_var = OA_Dal::factoryDO('data_bkt_a_var');
     $doData_bkt_a_var->find();
     $rows = $doData_bkt_a_var->getRowCount();
     $this->assertEqual($rows, 2);
     $doData_bkt_a_var = OA_Dal::factoryDO('data_bkt_a_var');
     $doData_bkt_a_var->server_conv_id = 1;
     $doData_bkt_a_var->server_raw_ip = 'singleDB';
     $doData_bkt_a_var->tracker_variable_id = 55;
     $doData_bkt_a_var->find();
     $rows = $doData_bkt_a_var->getRowCount();
     $this->assertEqual($rows, 1);
     $doData_bkt_a_var->fetch();
     $this->assertEqual($doData_bkt_a_var->value, 'foo');
     $this->assertEqual($doData_bkt_a_var->date_time, $oNowDate->format('%Y-%m-%d %H:%M:%S'));
     // Uninstall the openXDeliveryLog plugin
     TestEnv::uninstallPluginPackage('openXDeliveryLog', false);
     // Restore the test configuration file
     TestEnv::restoreConfig();
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:53,代码来源:log_a_var.del.test.php

示例7: test_setAllExtensions

 function test_setAllExtensions()
 {
     $oExtension = new OX_Extension();
     $GLOBALS['_MAX']['CONF']['pluginPaths']['plugins'] = '/lib/OX/tests/data/plugins/';
     $GLOBALS['_MAX']['CONF']['pluginPaths']['packages'] = '/lib/OX/tests/data/plugins/etc/';
     $oExtension->setAllExtensions();
     $aResult = $oExtension->aExtensions;
     $this->assertEqual(count($aResult), 3);
     sort($aResult);
     $this->assertEqual($aResult[0], 'admin');
     $this->assertEqual($aResult[1], 'test');
     $this->assertEqual($aResult[2], 'test1');
     TestEnv::restoreConfig();
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:14,代码来源:Extension.ext.test.php

示例8: testGetAgencyEcpmRemnantCampaignsDeliveriesToDate

 /**
  * Method to test the getAgencyCampaignsDeliveriesToDate 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 testGetAgencyEcpmRemnantCampaignsDeliveriesToDate()
 {
     TestEnv::restoreEnv();
     $priority = DataObjects_Campaigns::PRIORITY_ECPM;
     $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->getAgencyEcpmRemnantCampaignsDeliveriesToDate($agencyId1);
     $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->getAgencyEcpmRemnantCampaignsDeliveriesToDate($agencyId2);
     $this->_testResult($result);
     DataGenerator::cleanUp();
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:23,代码来源:Priority_getAgencyCampaignsDeliveriesToDate.dal.test.php

示例9: testGetZonesAllocationsByAgencyAndCampaignPriority

 /**
  * Method to test the getZonesAllocationsByAgencyAndCampaignPriority method.
  *
  * Requirements:
  * Test 1: Test with no data, and ensure no data returned.
  * Test 2: Test with sample data, and ensure the correct data is returned.
  */
 function testGetZonesAllocationsByAgencyAndCampaignPriority()
 {
     $oMaxDalMaintenance = new OA_Dal_Maintenance_Priority();
     list($agencyId1, $agencyId2) = $this->_generateData($priority = 5);
     $priority--;
     // always bigger priority is summed up
     // Test 1
     $result = $oMaxDalMaintenance->getZonesAllocationsByAgencyAndCampaignPriority($agencyId2, $priority);
     $this->assertEqual(0, count($result));
     // Test 2
     $aResult = $oMaxDalMaintenance->getZonesAllocationsByAgencyAndCampaignPriority($agencyId1, $priority);
     $this->assertEqual(1, count($aResult));
     $this->assertEqual(7, $aResult[$this->idZone1]);
     TestEnv::restoreEnv();
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:22,代码来源:Priority_getZonesAllocationsByAgency.dal.test.php

示例10: testSetMaintenancePriorityLastRunInfo

 /**
  * Method to test the setMaintenancePriorityLastRunInfo method.
  *
  * Requirements:
  * Test 1: Test with no data in the database, ensure data is correctly stored.
  * Test 2: Test with previous test data in the database, ensure data is correctly stored.
  */
 function testSetMaintenancePriorityLastRunInfo()
 {
     // Test relies on transaction numbers, so ensure fresh database used
     TestEnv::restoreEnv('dropTmpTables');
     $conf = $GLOBALS['_MAX']['CONF'];
     $oDbh =& OA_DB::singleton();
     $oMaxDalMaintenance = new OA_Dal_Maintenance_Priority();
     // Test 1
     $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');
     $result = $oMaxDalMaintenance->setMaintenancePriorityLastRunInfo($oStartDate, $oEndDate, $oUpdatedTo, DAL_PRIORITY_UPDATE_ECPM);
     $this->assertEqual($result, 1);
     $query = "\n            SELECT\n                start_run,\n                end_run,\n                operation_interval,\n                duration,\n                run_type,\n                updated_to\n            FROM\n                " . $oDbh->quoteIdentifier($conf['table']['prefix'] . $conf['table']['log_maintenance_priority'], true) . "\n            WHERE\n                log_maintenance_priority_id = 1";
     $rc = $oDbh->query($query);
     $aRow = $rc->fetchRow();
     $this->assertEqual($aRow['start_run'], '2005-06-21 15:00:01');
     $this->assertEqual($aRow['end_run'], '2005-06-21 15:01:01');
     $this->assertEqual($aRow['operation_interval'], $conf['maintenance']['operationInterval']);
     $this->assertEqual($aRow['duration'], 60);
     $this->assertEqual($aRow['run_type'], DAL_PRIORITY_UPDATE_ECPM);
     $this->assertEqual($aRow['updated_to'], '2005-06-21 15:59:59');
     // Test 2
     $oStartDate = new Date('2005-06-21 16:00:01');
     $oEndDate = new Date('2005-06-21 16:01:06');
     $oUpdatedTo = new Date('2005-06-21 16:59:59');
     $result = $oMaxDalMaintenance->setMaintenancePriorityLastRunInfo($oStartDate, $oEndDate, $oUpdatedTo, DAL_PRIORITY_UPDATE_PRIORITY_COMPENSATION);
     $this->assertEqual($result, 1);
     $query = "\n            SELECT\n                start_run,\n                end_run,\n                operation_interval,\n                duration,\n                run_type,\n                updated_to\n            FROM\n                " . $oDbh->quoteIdentifier($conf['table']['prefix'] . $conf['table']['log_maintenance_priority'], true) . "\n            WHERE\n                log_maintenance_priority_id = 1";
     $rc = $oDbh->query($query);
     $aRow = $rc->fetchRow();
     $this->assertEqual($aRow['start_run'], '2005-06-21 15:00:01');
     $this->assertEqual($aRow['end_run'], '2005-06-21 15:01:01');
     $this->assertEqual($aRow['operation_interval'], $conf['maintenance']['operationInterval']);
     $this->assertEqual($aRow['duration'], 60);
     $this->assertEqual($aRow['run_type'], DAL_PRIORITY_UPDATE_ECPM);
     $this->assertEqual($aRow['updated_to'], '2005-06-21 15:59:59');
     $query = "\n            SELECT\n                start_run,\n                end_run,\n                operation_interval,\n                duration,\n                run_type,\n                updated_to\n            FROM\n                " . $oDbh->quoteIdentifier($conf['table']['prefix'] . $conf['table']['log_maintenance_priority'], true) . "\n            WHERE\n                log_maintenance_priority_id = 2";
     $rc = $oDbh->query($query);
     $aRow = $rc->fetchRow();
     $this->assertEqual($aRow['start_run'], '2005-06-21 16:00:01');
     $this->assertEqual($aRow['end_run'], '2005-06-21 16:01:06');
     $this->assertEqual($aRow['operation_interval'], $conf['maintenance']['operationInterval']);
     $this->assertEqual($aRow['duration'], 65);
     $this->assertEqual($aRow['run_type'], DAL_PRIORITY_UPDATE_PRIORITY_COMPENSATION);
     $this->assertEqual($aRow['updated_to'], '2005-06-21 16:59:59');
     DataGenerator::cleanUp(array('log_maintenance_priority'));
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:55,代码来源:Priority_MaintenancePriorityLastRunInfo.dal.test.php

示例11: testRun

 /**
  * A method to test the run() method.
  */
 function testRun()
 {
     $oServiceLocator =& OA_ServiceLocator::instance();
     $aConf['maintenance']['operationInterval'] = 60;
     // Test 1: Test with the bucket data not having been migrated,
     //         and ensure that the DAL calls to de-duplicate and
     //         reject conversions are not made
     // Set the controller class
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     // Mock the MSE DAL used to de-duplicate conversions,
     // and set the expectations of the calls to the DAL
     Mock::generate('OX_Dal_Maintenance_Statistics');
     $oDal = new MockOX_Dal_Maintenance_Statistics($this);
     $oDal->expectNever('manageConversions');
     $oDal->__construct();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     // Set the controlling class' status and test
     $oManageConversions = new OX_Maintenance_Statistics_Task_ManageConversions();
     $oManageConversions->oController->updateIntermediate = false;
     $oManageConversions->run();
     $oDal->tally();
     // Test 2: Test with the bucket data having been migrated, and
     //         ensure that the DALL calls to de-duplicate and reject
     //         conversions are made correctly
     // Set the controller class
     $oMaintenanceStatistics = new OX_Maintenance_Statistics();
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     // Mock the MSE DAL used to de-duplicate conversions,
     // and set the expectations of the calls to the DAL
     Mock::generate('OX_Dal_Maintenance_Statistics');
     $oDal = new MockOX_Dal_Maintenance_Statistics($this);
     $oDate = new Date('2008-09-08 16:59:59');
     $oDate->addSeconds(1);
     $oDal->expectOnce('manageConversions', array($oDate, new Date('2008-09-08 17:59:59')));
     $oDal->__construct();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     // Set the controlling class' status and test
     $oManageConversions = new OX_Maintenance_Statistics_Task_ManageConversions();
     $oManageConversions->oController->updateIntermediate = true;
     $oManageConversions->oController->oLastDateIntermediate = new Date('2008-09-08 16:59:59');
     $oManageConversions->oController->oUpdateIntermediateToDate = new Date('2008-09-08 17:59:59');
     $oManageConversions->run();
     $oDal->tally();
     TestEnv::restoreConfig();
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:49,代码来源:ManageConversions.mtsdb.test.php

示例12: test_runScript

 function test_runScript()
 {
     $oUpgrade = new OA_Upgrade();
     $this->oConfiguration = $oUpgrade->oConfiguration;
     $oUpgrade->initDatabaseConnection();
     $oDbh =& $oUpgrade->oDbh;
     $oTable = new OA_DB_Table();
     $table = 'database_action';
     $testfile = MAX_PATH . "/lib/OA/Upgrade/tests/data/{$table}.xml";
     $oTable->init($testfile);
     $this->assertTrue($oTable->dropTable($this->prefix . $table), 'error dropping ' . $this->prefix . $table);
     $this->assertTrue($oTable->createTable($table), 'error creating ' . $this->prefix . $table);
     $aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
     $this->assertTrue(in_array($this->prefix . $table, $aExistingTables), 'old database_action table not found');
     $this->assertTrue($oUpgrade->runScript('prescript_openads_upgrade_2.3.33-beta-rc4.php'));
     TestEnv::restoreConfig();
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:17,代码来源:prescript_openads_upgrade_2.3.33-beta-rc4.up.test.php

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

示例14: test_convertEncoding

 /**
  * Test convertEncoding()
  *
  */
 function test_convertEncoding()
 {
     // Force client charset to latin1 so that the behaviour is similar to a real latin1 database
     // even if the database is encoded in utf8. At first we tried to drop the database an recreate
     // a latin1 encoded database, but PgSQL doesn't allow LATIN1 databases if the locale is set to
     // UTF-8.
     $GLOBALS['_MAX']['CONF']['databaseCharset'] = array('checkComplete' => true, 'clientCharset' => 'latin1');
     // However MySQL versions < 4.1.2 didn't support charsets, so we don't need to do that
     // and assume that a database can store any 8bit data (which is in fact true)
     if ($this->oDbh->dbsyntax == 'mysql') {
         $aVersion = $this->oDbh->getServerVersion();
         if (version_compare($aVersion['native'], '4.1.2', '<')) {
             $GLOBALS['_MAX']['CONF']['databaseCharset']['clientCharset'] = '';
         }
     }
     // Set client charset
     OA_DB::setCharset($this->oDbh);
     // These tables are required for the encoding migration
     $aTables = array('acls', 'acls_channel', 'ad_zone_assoc', 'affiliates', 'affiliates_extra', 'agency', 'application_variable', 'banners', 'campaigns', 'channel', 'clients', 'preference', 'session', 'tracker_append', 'trackers', 'userlog', 'variables', 'zones');
     // These tables are referenced by schema changes between 515 and 546, therefore need to be created
     $aOtherTables = array('preference_publisher', 'accounts', 'users', 'account_user_assoc');
     //array('preference', 'data_raw_tracker_click', 'data_summary_zone_country_daily', 'data_summary_zone_country_forecast', 'data_summary_zone_country_monthly', 'data_summary_zone_domain_page_daily', 'data_summary_zone_domain_page_forecast', 'data_summary_zone_domain_page_monthly', 'data_summary_zone_site_keyword_daily', 'data_summary_zone_site_keyword_forecast', 'data_summary_zone_site_keyword_monthly', 'data_summary_zone_source_daily', 'data_summary_zone_source_forecast', 'data_summary_zone_source_monthly', 'preference_advertiser', 'preference_publisher');
     $this->initDatabase(543, array_merge($aTables, $aOtherTables));
     $this->aIds = TestEnv::loadData('encoding_schema_543', 'mdb2schema');
     // MD5s verified manually setting the terminal encoding to the right encoding.
     $expected = array('latin1_utf8' => array(0 => array('campaignid' => $this->aIds['campaigns'][1], 'md5' => '1698982c38317c8c42ae4772bbee8f44'), 1 => array('campaignid' => $this->aIds['campaigns'][2], 'md5' => '317f56003783a2a9284306eb57fe8146'), 2 => array('campaignid' => $this->aIds['campaigns'][3], 'md5' => 'fa419947d425b10bd2485e090f4cae60'), 3 => array('campaignid' => $this->aIds['campaigns'][4], 'md5' => '32395feef462f13071c2a2fe5e44c7c0'), 4 => array('campaignid' => $this->aIds['campaigns'][5], 'md5' => '9932d540cb5b63f264b3f7391577fe93'), 5 => array('campaignid' => $this->aIds['campaigns'][6], 'md5' => 'c6ae927806e0a61f9cd269659a225435')), 'utf8_utf8' => array(0 => array('campaignid' => $this->aIds['campaigns'][1], 'md5' => '1698982c38317c8c42ae4772bbee8f44'), 1 => array('campaignid' => $this->aIds['campaigns'][2], 'md5' => '317f56003783a2a9284306eb57fe8146'), 2 => array('campaignid' => $this->aIds['campaigns'][3], 'md5' => '8c8755d8f519c0245717475757d043f7'), 3 => array('campaignid' => $this->aIds['campaigns'][4], 'md5' => '7269db488f9672cca26d93105a9a2559'), 4 => array('campaignid' => $this->aIds['campaigns'][5], 'md5' => '19397ed80befa5539761afed23c4c27a'), 5 => array('campaignid' => $this->aIds['campaigns'][6], 'md5' => 'a7d508c6c8a494c80e680033cecbc76d')));
     $tblCampaigns = $this->oDbh->quoteIdentifier($this->getPrefix() . 'campaigns', true);
     // Check that the campaign names are correctly created:
     $query = "SELECT campaignid, campaignname FROM {$tblCampaigns}";
     $result = $this->oDbh->queryAll($query);
     foreach (array_keys($result) as $k) {
         $result[$k]['md5'] = md5($result[$k]['campaignname']);
         unset($result[$k]['campaignname']);
     }
     $this->assertIdentical($result, $expected['latin1_utf8']);
     // Upgrade the dataset and ensure that the upgraded campaign names were upgraded correctly:
     $this->upgradeToVersion(544);
     // Fields requiring encoding changes should now be correct
     $query = "SELECT campaignid, campaignname FROM {$tblCampaigns}";
     $result = $this->oDbh->queryAll($query);
     foreach (array_keys($result) as $k) {
         $result[$k]['md5'] = md5($result[$k]['campaignname']);
         unset($result[$k]['campaignname']);
     }
     $this->assertIdentical($result, $expected['utf8_utf8']);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:50,代码来源:EncodingMigration.mig.test.php

示例15: test_cacheMergedMenu

 function test_cacheMergedMenu()
 {
     Mock::generatePartial('OX_Plugin_ComponentGroupManager', $oMockGroupManager = 'OX_Plugin_ComponentGroupManager' . rand(), array('mergeMenu'));
     $oGroupManager = new $oMockGroupManager($this);
     $oGroupManager->setReturnValue('mergeMenu', true);
     Mock::generatePartial('OX_Extension_admin', $oMockExtensionManager = 'OX_Extension_admin' . rand(), array('_getMenuObjectForAccount', '_getGroupManagerObject'));
     $oMockExtensionManager = new $oMockExtensionManager($this);
     $oMenu = new OA_Admin_Menu('TEST');
     $oMenu->add(new OA_Admin_Menu_Section("test", 'test root', "test-root.php", false, ""));
     $oMockExtensionManager->setReturnValue('_getMenuObjectForAccount', $oMenu);
     $oMockExtensionManager->setReturnValue('_getGroupManagerObject', $oGroupManager);
     OA_Admin_Menu::_clearCache('TEST');
     $this->assertTrue($oMockExtensionManager->_cacheMergedMenu('TEST'));
     $oMenuCache = $oMenu->_loadFromCache('TEST');
     $this->assertTrue(is_a($oMenuCache, 'OA_Admin_Menu'));
     $this->assertEqual(count($oMenuCache->aAllSections), 1);
     $this->assertTrue(array_key_exists('test', $oMenuCache->aAllSections));
     OA_Admin_Menu::_clearCache('TEST');
     TestEnv::restoreConfig();
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:20,代码来源:Extension_admin.ext.test.php


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