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


PHP TestEnv::restoreConfig方法代码示例

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


在下文中一共展示了TestEnv::restoreConfig方法的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()
 {
     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

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

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

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

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

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

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

示例9: test_cachePreferenceOptions

 function test_cachePreferenceOptions()
 {
     $oExtension = new OX_Extension_Common();
     $GLOBALS['_MAX']['CONF']['pluginPaths']['packages'] = '/lib/OX/Extension/tests/data/';
     $GLOBALS['_MAX']['CONF']['pluginGroupComponents'] = array('testPlugin' => 1);
     $this->_backupCacheFile('PrefOptions_Plugins');
     $oExtension->cachePreferenceOptions();
     $oCache = new OA_Cache('Plugins', 'PrefOptions');
     $oCache->setFileNameProtection(false);
     $aPrefOptions = $oCache->load(true);
     $this->assertIsA($aPrefOptions, 'array');
     $this->assertEqual(count($aPrefOptions), 1);
     $this->assertTrue(isset($aPrefOptions['testPlugin']));
     $this->assertTrue(isset($aPrefOptions['testPlugin']['value']));
     $this->assertTrue(isset($aPrefOptions['testPlugin']['name']));
     $this->assertTrue(isset($aPrefOptions['testPlugin']['perm']));
     $this->assertEqual($aPrefOptions['testPlugin']['name'], 'testPlugin');
     $this->assertEqual($aPrefOptions['testPlugin']['text'], 'Option Text');
     $this->assertEqual($aPrefOptions['testPlugin']['value'], 'account-preferences-plugin.php?group=testPlugin');
     $this->assertEqual(count($aPrefOptions['testPlugin']['perm']), 4);
     $this->_restoreCacheFile('PrefOptions_Plugins');
     TestEnv::restoreConfig();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:23,代码来源:ExtensionCommon.ext.test.php

示例10: testChangePluginPaths

 function testChangePluginPaths()
 {
     TestEnv::restoreConfig();
     // prepare data
     $oUpgrade = new OA_Upgrade();
     $oUpgrade->oConfiguration = new OA_Upgrade_Config();
     Mock::generatePartial('OA_UpgradePostscript_2_7_31_beta_rc1', $mockName = 'OA_UpgradePostscript_2_7_31_beta_rc1' . rand(), array('logOnly', 'logError'));
     $doMockPostUpgrade = new $mockName($this);
     $doMockPostUpgrade->oUpgrade =& $oUpgrade;
     // delete max section to make a new max section for testing
     unset($doMockPostUpgrade->oUpgrade->oConfiguration->aConfig['pluginPaths']);
     $doMockPostUpgrade->oUpgrade->oConfiguration->aConfig['pluginUpdatesServer'] = array('protocol' => 'test', 'host' => 'test', 'path' => 'test', 'httpPort' => 'test');
     $this->assertNull($doMockPostUpgrade->oUpgrade->oConfiguration->aConfig['pluginPaths']);
     $doMockPostUpgrade->oUpgrade->oConfiguration->aConfig['pluginPaths'] = array('packages' => '/extensions/etc/', 'extensions' => '/extensions/', 'admin' => '/www/admin/plugins/', 'var' => '/var/plugins/', 'plugins' => '/plugins/');
     // check that aConfig pluginPaths section is not null
     $this->assertNotNull($doMockPostUpgrade->oUpgrade->oConfiguration->aConfig['pluginPaths']);
     // Execute
     $doMockPostUpgrade->execute(array($oUpgrade));
     // assert that ['pluginPaths'] and ['pluginUpdatesServer have been upgraded to the correct values
     $this->assertEqual($doMockPostUpgrade->oUpgrade->oConfiguration->aConfig['pluginPaths']['packages'], '/plugins/etc/');
     $this->assertNull($doMockPostUpgrade->oUpgrade->oConfiguration->aConfig['pluginPaths']['extensions']);
     $this->assertEqual($doMockPostUpgrade->oUpgrade->oConfiguration->aConfig['pluginUpdatesServer'], array('protocol' => 'http', 'host' => 'code.openx.org', 'path' => '/openx/plugin-updates', 'httpPort' => '80'));
     TestEnv::restoreConfig();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:24,代码来源:postscript_openads_upgrade_2.7.31-beta-rc1.mig.test.php

示例11: testSaveSummary


//.........这里部分代码省略.........
     $aRow = $oDbh->queryRow($query);
     $this->assertEqual($aRow['date_time'], '2004-06-06 18:00:00');
     $this->assertEqual($aRow['creative_id'], 1);
     $this->assertEqual($aRow['zone_id'], 2);
     $this->assertEqual($aRow['impressions'], 1);
     $this->assertEqual($aRow['clicks'], 1);
     $this->assertEqual($aRow['conversions'], 0);
     $this->assertEqual($aRow['total_basket_value'], 0);
     $this->assertEqual($aRow['total_revenue'], 0);
     $query = "\n            SELECT\n                *\n            FROM\n                " . $oDbh->quoteIdentifier($aConf['table']['prefix'] . $aConf['table']['data_summary_ad_hourly'], true) . "\n            WHERE\n                ad_id = 4\n            ORDER BY\n                zone_id";
     $rc = $oDbh->query($query);
     $this->assertEqual($rc->numRows(), 4);
     $aRow = $rc->fetchRow();
     $this->assertEqual($aRow['date_time'], '2004-06-06 18:00:00');
     $this->assertEqual($aRow['creative_id'], 1);
     $this->assertEqual($aRow['zone_id'], 3);
     $this->assertEqual($aRow['impressions'], 1);
     $this->assertEqual($aRow['clicks'], 1);
     $this->assertEqual($aRow['conversions'], 5);
     $this->assertEqual($aRow['total_basket_value'], 0);
     $this->assertEqual($aRow['total_revenue'], 20);
     $aRow = $rc->fetchRow();
     $this->assertEqual($aRow['date_time'], '2004-06-06 18:00:00');
     $this->assertEqual($aRow['creative_id'], 1);
     $this->assertEqual($aRow['zone_id'], 4);
     $this->assertEqual($aRow['impressions'], 1);
     $this->assertEqual($aRow['clicks'], 1);
     $this->assertEqual($aRow['conversions'], 5);
     $this->assertEqual($aRow['total_basket_value'], 0);
     $this->assertEqual($aRow['total_revenue'], 20);
     $aRow = $rc->fetchRow();
     $this->assertEqual($aRow['date_time'], '2004-06-06 18:00:00');
     $this->assertEqual($aRow['creative_id'], 1);
     $this->assertEqual($aRow['zone_id'], 5);
     $this->assertEqual($aRow['impressions'], 1);
     $this->assertEqual($aRow['clicks'], 1);
     $this->assertEqual($aRow['conversions'], 5);
     $this->assertEqual($aRow['total_basket_value'], 100);
     $this->assertEqual($aRow['total_revenue'], 20);
     $aRow = $rc->fetchRow();
     $this->assertEqual($aRow['date_time'], '2004-06-06 18:00:00');
     $this->assertEqual($aRow['creative_id'], 1);
     $this->assertEqual($aRow['zone_id'], 6);
     $this->assertEqual($aRow['impressions'], 1);
     $this->assertEqual($aRow['clicks'], 1);
     $this->assertEqual($aRow['conversions'], 5);
     $this->assertEqual($aRow['total_basket_value'], 100);
     $this->assertEqual($aRow['total_revenue'], 20);
     TestEnv::restoreEnv();
     // Test 3
     // Insert the test data
     $this->_insertTestSaveSummaryPlacement();
     $this->_insertTestSaveSummaryAd();
     $this->_insertTestSaveSummaryZone();
     $aData = array('2004-06-06 18:00:00', 30, 36, '2004-06-06 18:00:00', '2004-06-06 18:29:59', 1, 1, 1, 1, 1, 1, 1);
     $rows = $st->execute($aData);
     $aData = array('2004-06-07 18:00:00', 30, 36, '2004-06-07 18:00:00', '2004-06-07 18:29:59', 1, 2, 1, 1, 1, 1, 1);
     $rows = $st->execute($aData);
     $aData = array('2004-06-07 18:00:00', 30, 36, '2004-06-07 18:00:00', '2004-06-07 18:29:59', 1, 2, 1, 1, 1, 1, 1);
     $rows = $st->execute($aData);
     $aData = array('2004-06-08 18:00:00', 30, 36, '2004-06-08 18:00:00', '2004-06-08 18:29:59', 2, 1, 1, 1, 1, 0, 0);
     $rows = $st->execute($aData);
     // Test
     $start = new Date('2004-06-06 18:00:00');
     $end = new Date('2004-06-08 18:29:59');
     $oDalMaintenanceStatistics->saveSummary($start, $end, $aActionTypes, 'data_intermediate_ad', 'data_summary_ad_hourly');
     $query = "\n            SELECT\n                COUNT(*) AS number\n            FROM\n                " . $oDbh->quoteIdentifier($aConf['table']['prefix'] . $aConf['table']['data_summary_ad_hourly'], true);
     $aRow = $oDbh->queryRow($query);
     $this->assertEqual($aRow['number'], 3);
     $query = "\n            SELECT\n                *\n            FROM\n                " . $oDbh->quoteIdentifier($aConf['table']['prefix'] . $aConf['table']['data_summary_ad_hourly'], true) . "\n            WHERE\n                ad_id = 1\n                AND creative_id = 1";
     $aRow = $oDbh->queryRow($query);
     $this->assertEqual($aRow['date_time'], '2004-06-06 18:00:00');
     $this->assertEqual($aRow['zone_id'], 1);
     $this->assertEqual($aRow['impressions'], 1);
     $this->assertEqual($aRow['clicks'], 1);
     $this->assertEqual($aRow['conversions'], 1);
     $this->assertEqual($aRow['total_basket_value'], 1);
     $this->assertEqual($aRow['total_revenue'], 5);
     $query = "\n            SELECT\n                *\n            FROM\n                " . $oDbh->quoteIdentifier($aConf['table']['prefix'] . $aConf['table']['data_summary_ad_hourly'], true) . "\n            WHERE\n                ad_id = 1\n                AND creative_id = 2";
     $aRow = $oDbh->queryRow($query);
     $this->assertEqual($aRow['date_time'], '2004-06-07 18:00:00');
     $this->assertEqual($aRow['zone_id'], 1);
     $this->assertEqual($aRow['impressions'], 2);
     $this->assertEqual($aRow['clicks'], 2);
     $this->assertEqual($aRow['conversions'], 2);
     $this->assertEqual($aRow['total_basket_value'], 2);
     $this->assertEqual($aRow['total_revenue'], 10);
     $query = "\n            SELECT\n                *\n            FROM\n                " . $oDbh->quoteIdentifier($aConf['table']['prefix'] . $aConf['table']['data_summary_ad_hourly'], true) . "\n            WHERE\n                ad_id = 2";
     $aRow = $oDbh->queryRow($query);
     $this->assertEqual($aRow['date_time'], '2004-06-08 18:00:00');
     $this->assertEqual($aRow['creative_id'], 1);
     $this->assertEqual($aRow['zone_id'], 1);
     $this->assertEqual($aRow['impressions'], 1);
     $this->assertEqual($aRow['clicks'], 1);
     $this->assertEqual($aRow['conversions'], 0);
     $this->assertEqual($aRow['total_basket_value'], 0);
     $this->assertEqual($aRow['total_revenue'], 2);
     TestEnv::restoreEnv();
     TestEnv::restoreConfig();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:Statistics_saveSummary.dal.test.php

示例12: test_upgradeIncremental

 /**
  * tests an openads upgrade where a series of upgrade packages may be required
  * the upgrade method will detectOpenXand cycle through the list of upgrade packages
  * executing the upgrade packages in the right order
  * until it runs out of upgrade packages
  * when no more upgrade packages are found
  * the application is stamped with the latest version
  *
  */
 function test_upgradeIncremental()
 {
     $oUpgrade = new OA_Upgrade();
     Mock::generatePartial('OA_Upgrade_Config', $mockConfig = 'OA_Upgrade_Config' . rand(), array('backupConfig', 'mergeConfig', 'setupConfigDatabase', 'setupConfigTable', 'setValue', 'writeConfig', 'getConfigBackupName', 'clearConfigBackupName', 'setBulkValue'));
     $oUpgrade->oConfiguration = new $mockConfig($this);
     $oUpgrade->oConfiguration->setReturnValue('setupConfigDatabase', true);
     $oUpgrade->oConfiguration->setReturnValue('setupConfigTable', true);
     $oUpgrade->oConfiguration->setReturnValue('setValue', true);
     $oUpgrade->oConfiguration->setReturnValue('writeConfig', true);
     $oUpgrade->oConfiguration->expectCallCount('backupConfig', 1);
     $oUpgrade->oConfiguration->setReturnValue('backupConfig', true);
     $oUpgrade->oConfiguration->expectCallCount('mergeConfig', 1);
     $oUpgrade->oConfiguration->setReturnValue('mergeConfig', true);
     $oUpgrade->oConfiguration->expectCallCount('getConfigBackupName', 13);
     for ($i = 0; $i < 13; $i++) {
         $oUpgrade->oConfiguration->setReturnValueAt($i, 'getConfigBackupName', $i . '_old.www.mysite.net.conf.php');
         // drop a fake conf backup
         @copy(MAX_PATH . '/var/test.conf.php', MAX_PATH . '/var/' . $i . '_old.www.mysite.net.conf.php');
     }
     // divert objects to test data
     $oUpgrade->upgradePath = MAX_PATH . '/lib/OA/Upgrade/tests/data/changes/';
     $GLOBALS['_MAX']['CONF']['openads']['installed'] = true;
     $this->_dropTestTable($oUpgrade->oDbh, 'database_action');
     $this->_dropTestTable($oUpgrade->oDbh, 'upgrade_action');
     // just in case of error, lose this so we can continue afresh
     $oUpgrade->_pickupRecoveryFile();
     // fake the versions we are starting with
     $this->_createTestAppVarRecord('oa_version', '2.3.32-beta-rc1');
     // mock the integrity checker
     Mock::generatePartial('OA_DB_Integrity', $mockInteg = 'OA_DB_Integrity' . rand(), array('checkIntegrityQuick'));
     $oUpgrade->oIntegrity = new $mockInteg($this);
     $oUpgrade->oIntegrity->setReturnValue('checkIntegrityQuick', true);
     // do the initial detection
     $this->assertTrue($oUpgrade->detectOpenads());
     // this should identify 12 upgrade packages to be executed
     // (from /lib/OA/Upgrade/tests/data/changes)
     $this->assertEqual(count($oUpgrade->aPackageList), 12, 'wrong number of packages in upgrader package list');
     $this->assertIsA($oUpgrade->oAuditor, 'OA_UpgradeAuditor', 'class mismatch: OA_UpgradeAuditor');
     // perform the upgrade
     $this->assertTrue($oUpgrade->upgrade(), 'upgrade');
     $aAudit = $oUpgrade->oAuditor->queryAuditAllDescending();
     // we should have 13 records in the upgrade_action audit table
     // we should have 13 logfiles in the var folder
     // one for each package plus a version stamp
     $this->assertEqual(count($aAudit), 13, 'wrong number of audit records');
     $aPackageList = $oUpgrade->aPackageList;
     krsort($aPackageList, SORT_NUMERIC);
     foreach ($aAudit as $k => $aRec) {
         $idx = 12 - $k;
         $this->assertEqual($aRec['upgrade_action_id'], $idx + 1, '');
         $this->assertEqual($aRec['confbackup'], $idx . '_old.www.mysite.net.conf.php');
         $this->assertTrue(file_exists(MAX_PATH . '/var/' . $aRec['logfile']));
         @unlink(MAX_PATH . '/var/' . $aRec['logfile']);
         if ($k > 0) {
             $this->assertEqual($aRec['upgrade_name'], $aPackageList[$idx], 'package mismatch: ' . $aRec['upgrade_name'] . ' and ' . $aPackageList[$idx]);
         } else {
             $this->assertEqual($aRec['upgrade_name'], 'openads_version_stamp_' . VERSION, 'wrong package name for version stamp');
         }
     }
     // the application variable should match the code version stamp
     $this->assertEqual($oUpgrade->versionInitialApplication, VERSION, 'wrong initial application version: ' . $oUpgrade->versionInitialApplication);
     //        $this->_deleteTestAppVarRecordAllNames('oa_version');
     $oUpgrade->oConfiguration->tally();
     $oUpgrade->oIntegrity->tally();
     TestEnv::restoreConfig();
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:75,代码来源:Upgrade.up.test.php

示例13: test_createAuditTable

 /**
  * Test 1: with lowercase prefix
  * Test 2: with uppercase prefix
  */
 function test_createAuditTable()
 {
     // Test 1
     $GLOBALS['_MAX']['CONF']['table']['prefix'] = 'oa_';
     $oAuditor = $this->_getAuditObject('OA_DB_UpgradeAuditor');
     $this->_dropAuditTable($oAuditor->prefix . $oAuditor->logTable);
     $this->assertTrue($oAuditor->_createAuditTable(), 'failed to createAuditTable');
     $aDBTables = OA_DB_Table::listOATablesCaseSensitive();
     $this->assertTrue(in_array($oAuditor->prefix . $oAuditor->logTable, $aDBTables));
     $this->_dropAuditTable($oAuditor->prefix . $oAuditor->logTable);
     TestEnv::restoreConfig();
     //TestEnv::restoreEnv();
     // Test 2
     $GLOBALS['_MAX']['CONF']['table']['prefix'] = 'OA_';
     $oAuditor = $this->_getAuditObject('OA_DB_UpgradeAuditor');
     $this->_dropAuditTable($oAuditor->prefix . $oAuditor->logTable);
     $this->assertTrue($oAuditor->_createAuditTable(), 'failed to createAuditTable');
     $aDBTables = OA_DB_Table::listOATablesCaseSensitive();
     $this->assertTrue(in_array($oAuditor->prefix . $oAuditor->logTable, $aDBTables));
     $this->_dropAuditTable($oAuditor->prefix . $oAuditor->logTable);
     TestEnv::restoreConfig();
     //TestEnv::restoreEnv();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:27,代码来源:DB_UpgradeAuditor.up.test.php

示例14: testGetSequenceName

 function testGetSequenceName()
 {
     $conf =& $GLOBALS['_MAX']['CONF'];
     $prefix = $conf['table']['prefix'] = 'ox_';
     $oDbh =& OA_DB::singleton();
     if ($oDbh->dbsyntax == 'pgsql') {
         $this->assertEqual(OA_DB::getSequenceName($oDbh, 'x', 'a'), 'ox_x_a_seq');
         $this->assertEqual(OA_DB::getSequenceName($oDbh, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyy', 'a'), 'ox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_a_seq');
         $this->assertEqual(OA_DB::getSequenceName($oDbh, 'x', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabb'), 'ox_x_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_seq');
         $this->assertEqual(OA_DB::getSequenceName($oDbh, 'xxxxxxxxxxxxxxxxxxxxxxxxxxy', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaab'), 'ox_xxxxxxxxxxxxxxxxxxxxxxxxxx_aaaaaaaaaaaaaaaaaaaaaaaaaaaaa_seq');
         $this->assertEqual(OA_DB::getSequenceName($oDbh, 'x', 'a', false), 'ox_x_a');
         $this->assertEqual(OA_DB::getSequenceName($oDbh, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyy', 'a', false), 'ox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_a');
         $this->assertEqual(OA_DB::getSequenceName($oDbh, 'x', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabb', false), 'ox_x_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
         $this->assertEqual(OA_DB::getSequenceName($oDbh, 'xxxxxxxxxxxxxxxxxxxxxxxxxxy', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaab', false), 'ox_xxxxxxxxxxxxxxxxxxxxxxxxxx_aaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
     } else {
         $this->assertEqual(OA_DB::getSequenceName($oDbh, 'x', 'a'), 'x');
         $this->assertEqual(OA_DB::getSequenceName($oDbh, 'x', 'a', false), 'x');
     }
     TestEnv::restoreConfig();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:20,代码来源:DB.db.test.php

示例15: _testMigratePrefsToSettings

 /**
  * A private method that tests that preferences have been
  * correctly migrated to settings.
  *
  * @access private
  * @param integer $set The index number of the preference
  *                     set that has been configured.
  */
 function _testMigratePrefsToSettings($set)
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     // Get the expected results of the migration of preferences to settings
     $aSettingsExpectations = $this->_getSettingsExpectations($set);
     // Test the settings are correct
     foreach ($aSettingsExpectations as $section => $aPair) {
         $this->assertTrue(isset($aConf[$section]), "Section '{$section}' missing");
         foreach ($aPair as $key => $value) {
             $this->assertTrue(isset($aConf[$section][$key]), "Key '{$key}' in section '{$section}' missing");
             $this->assertEqual($aConf[$section][$key], $value, "Incorrect value \$aConf[{$section}][{$key}]: {{$aConf[$section][$key]}} != {{$value}}");
         }
     }
     TestEnv::restoreConfig();
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:23,代码来源:UserMigration.mig.test.php


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