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


PHP TestEnv::restoreEnv方法代码示例

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


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

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

示例2: test_backupTables

 function test_backupTables()
 {
     $GLOBALS['_MAX']['CONF']['pluginPaths']['repo'] = $GLOBALS['_MAX']['CONF']['pluginPaths']['repo'] . '|' . MAX_PATH . $this->testpathData . 'plugins_repo/';
     $zipFile = $this->testpathData . 'plugins_repo/' . 'testPluginPackage_v3.zip';
     $plugin = $this->testpathData . 'plugins_repo/' . 'testPluginPackage.zip';
     if (file_exists($zipFile) && !unlink($zipFile)) {
         $this->fail('error unlinking ' . $zipFile);
         return false;
     }
     if (!copy(MAX_PATH . $zipFile, MAX_PATH . $plugin)) {
         $this->fail('error copying ' . $zipFile);
         return false;
     }
     if (!file_exists(MAX_PATH . $plugin)) {
         $this->fail('file does not exist ' . $plugin);
         return false;
     }
     TestEnv::installPluginPackage('testPluginPackage', false);
     $prefix = $GLOBALS['_MAX']['CONF']['table']['prefix'];
     $oExport = new OX_PluginExport();
     $oExport->init('testPluginPackage');
     $aTables = OA_DB_Table::listOATablesCaseSensitive('testplugin_table');
     $this->assertEqual(count($aTables), 1);
     $this->assertEqual($aTables[0], $prefix . 'testplugin_table');
     $this->assertTrue($oExport->backupTables('testPluginPackage'));
     $aTables = OA_DB_Table::listOATablesCaseSensitive('testplugin_table');
     $this->assertEqual(count($aTables), 2);
     $this->assertEqual($aTables[0], $prefix . 'testplugin_table');
     $this->assertPattern('/' . $prefix . 'testplugin_table_' . date('Ymd') . '_[\\d]{6}/', $aTables[1]);
     TestEnv::uninstallPluginPackage('testPluginPackage', false);
     TestEnv::restoreConfig();
     TestEnv::restoreEnv();
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:33,代码来源:PluginExport.plg.test.php

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

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

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

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

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

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

示例9: testAllMaintenanceStatisticsTables

 /**
  * Tests creating/dropping all of the MPE temporary tables.
  *
  * Requirements:
  * Test 1: Test that all MPE temporary tables can be created and dropped.
  */
 function testAllMaintenanceStatisticsTables()
 {
     $tmpTables = array('tmp_ad_impression', 'tmp_ad_click', 'tmp_tracker_impression_ad_impression_connection', 'tmp_tracker_impression_ad_click_connection', 'tmp_ad_connection');
     // Test 1
     $conf =& $GLOBALS['_MAX']['CONF'];
     $conf['table']['prefix'] = '';
     $oDbh =& OA_DB::singleton();
     foreach ($tmpTables as $tableName) {
         $query = "SELECT * FROM {$tableName}";
         OA::disableErrorHandling();
         $result = $oDbh->query($query);
         OA::enableErrorHandling();
         $this->assertEqual(strtolower(get_class($result)), 'mdb2_error');
     }
     $oTable =& OA_DB_Table_Statistics::singleton();
     foreach ($tmpTables as $tableName) {
         $oTable->createTable($tableName);
     }
     $aExistingTables = OA_DB_Table::listOATablesCaseSensitive();
     foreach ($tmpTables as $tableName) {
         // Test that the table has been created
         $query = "SELECT * FROM {$tableName}";
         $result = $oDbh->query($query);
         $this->assertTrue($result);
         // Test that the table can be dropped
         // Use a different query to overcome MDB2 query buffering
         $query = "SELECT foo FROM {$tableName}";
         OA::disableErrorHandling();
         $result = $oDbh->query($query);
         OA::enableErrorHandling();
         $this->assertEqual(strtolower(get_class($result)), 'mdb2_error');
     }
     // Restore the testing environment
     TestEnv::restoreEnv();
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:41,代码来源:Statistics.tbl.test.php

示例10: test_BackupAndRollback_restoreAutoIncrement

 /**
  * this test calls backup method then immediately rollsback
  * emulating an upgrade error without interrupt (can recover in same session)
  *
  */
 function test_BackupAndRollback_restoreAutoIncrement()
 {
     $oDB_Upgrade = $this->_newDBUpgradeObject();
     $oDB_Upgrade->oAuditor->auditId = 5;
     $oDB_Upgrade->oAuditor->setKeyParams(array('schema_name' => 'tables_core', 'version' => '920', 'timing' => 0));
     $this->_createTestTableAutoInc($oDB_Upgrade->oSchema->db);
     $oDB_Upgrade->aChanges['affected_tables']['constructive'] = array('table1_autoinc');
     OA_DB::setCaseSensitive();
     $aTbl_def_orig = $oDB_Upgrade->oSchema->getDefinitionFromDatabase(array($this->prefix . 'table1_autoinc'));
     OA_DB::disableCaseSensitive();
     $this->assertTrue($oDB_Upgrade->_backup(), '_backup failed');
     $this->assertTrue($oDB_Upgrade->prepRollbackByAuditId(5, $version, $schema), 'prep rollback failed');
     $this->assertIsA($oDB_Upgrade->aRestoreTables, 'array', 'aRestoreTables not an array');
     $this->assertTrue(array_key_exists('table1_autoinc', $oDB_Upgrade->aRestoreTables['tables_core']['920']), 'table not found in aRestoreTables');
     $this->assertTrue(array_key_exists('tablename_backup', $oDB_Upgrade->aRestoreTables['tables_core']['920']['table1_autoinc'][0]), 'backup table name not found for table1_autoinc');
     $this->assertTrue(array_key_exists('table_backup_schema', $oDB_Upgrade->aRestoreTables['tables_core']['920']['table1_autoinc'][0]), 'definition array not found for table1_autoinc');
     $oDB_Upgrade->aDBTables = $oDB_Upgrade->_listTables();
     $table_bak = $oDB_Upgrade->aRestoreTables['tables_core']['920']['table1_autoinc'][0]['tablename_backup'];
     $this->assertTrue($this->_tableExists($table_bak, $oDB_Upgrade->aDBTables), 'backup table not found in database');
     //OA_DB::setQuoteIdentifier();
     OA_DB::setCaseSensitive();
     $aTbl_def_bak = $oDB_Upgrade->oSchema->getDefinitionFromDatabase(array($this->prefix . $table_bak));
     OA_DB::disableCaseSensitive();
     //OA_DB::disabledQuoteIdentifier();
     $aTbl_def_orig = $aTbl_def_orig['tables'][$this->prefix . 'table1_autoinc'];
     $aTbl_def_bak = $aTbl_def_bak['tables'][$this->prefix . $table_bak];
     foreach ($aTbl_def_orig['fields'] as $name => $aType) {
         $this->assertTrue(array_key_exists($name, $aTbl_def_bak['fields']), 'field missing from backup table');
     }
     $oDB_Upgrade->oSchema->db->manager->dropTable($this->prefix . 'table1_autoinc');
     $oDB_Upgrade->aDBTables = $oDB_Upgrade->_listTables();
     $this->assertFalse($this->_tableExists('table1_autoinc', $oDB_Upgrade->aDBTables), 'could not drop test table');
     $this->assertTrue($oDB_Upgrade->rollback(), 'rollback failed');
     $oDB_Upgrade->aDBTables = $oDB_Upgrade->_listTables();
     $this->assertTrue($this->_tableExists('table1_autoinc', $oDB_Upgrade->aDBTables), 'test table was not restored');
     OA_DB::setCaseSensitive();
     $aTbl_def_rest = $oDB_Upgrade->oSchema->getDefinitionFromDatabase(array($this->prefix . 'table1_autoinc'));
     OA_DB::disableCaseSensitive();
     $aTbl_def_rest = $aTbl_def_rest['tables']['table1_autoinc'];
     // also test field definition properties?
     $aDiffs = $oDB_Upgrade->oSchema->compareDefinitions($aTbl_def_orig, $aTbl_def_rest);
     $this->assertEqual(count($aDiffs) == 0, 'differences found in restored table');
     $this->assertFalse($this->_tableExists($table_bak, $oDB_Upgrade->aDBTables), 'backup table was not removed');
     TestEnv::restoreConfig();
     TestEnv::restoreEnv();
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:51,代码来源:DB_Upgrade.up.test.php

示例11: test_upgradeSchemas

 /**
  * tests an upgrade package containing two schema upgrades
  *
  */
 function test_upgradeSchemas()
 {
     $this->_deleteTestAppVarRecord('tables_core', '');
     $this->assertEqual($this->_getTestAppVarValue('tables_core', ''), '', '');
     $this->_createTestAppVarRecord('tables_core', '997');
     $this->assertEqual($this->_getTestAppVarValue('tables_core', '997'), '997', '');
     $this->_createTestAppVarRecord('oa_version', '2.3.00');
     $oUpgrade->versionInitialSchema['tables_core'] = 997;
     $oUpgrade->versionInitialApplication = '2.3.00';
     $oUpgrade = new OA_Upgrade();
     $oUpgrade->upgradePath = MAX_PATH . '/lib/OA/Upgrade/tests/data/';
     $oUpgrade->oDBUpgrader->path_changes = $oUpgrade->upgradePath;
     $oUpgrade->oDBUpgrader->path_schema = $oUpgrade->upgradePath;
     $input_file = 'openads_upgrade_2.3.00_to_2.3.02_beta.xml';
     $oUpgrade->initDatabaseConnection();
     $oUpgrade->_parseUpgradePackageFile($oUpgrade->upgradePath . $input_file);
     $this->assertTrue($oUpgrade->upgradeSchemas(), 'upgradeSchemas');
     $this->_checkTablesUpgraded($oUpgrade);
     $this->assertEqual($this->_getTestAppVarValue('tables_core', '999'), '999', '');
     // remove the fake application variable records
     $this->_deleteTestAppVarRecordAllNames('oa_version');
     $this->_deleteTestAppVarRecordAllNames('tables_core');
     TestEnv::restoreConfig();
     TestEnv::restoreEnv();
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:29,代码来源:Upgrade.up.test.php

示例12: testRun


//.........这里部分代码省略.........
     $oMaintenanceStatistics->oLastDateIntermediate = new Date('2008-08-28 07:59:59');
     $oMaintenanceStatistics->oUpdateIntermediateToDate = new Date('2008-08-28 10:59:59');
     $oServiceLocator->register('Maintenance_Statistics_Controller', $oMaintenanceStatistics);
     Mock::generatePartial($oDalMaintenanceStatsticsClassName, 'MockOX_Dal_Maintenance_Statistics_Test_6', array('summariseBucketsRaw', 'summariseBucketsRawSupplementary', 'summariseBucketsAggregate', 'migrateRawRequests', 'migrateRawImpressions', 'migrateRawClicks'));
     $oDal = new MockOX_Dal_Maintenance_Statistics_Test_6($this);
     $oDal->expectCallCount('summariseBucketsRaw', 3);
     $oDal->expectCallCount('summariseBucketsRawSupplementary', 3);
     $oDal->expectCallCount('summariseBucketsAggregate', 3);
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogConversion', 'logConversion');
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'summariseBucketsRaw', array($aConf['table']['prefix'] . 'data_intermediate_ad_connection', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogConversion', 'logConversionVariable');
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'summariseBucketsRawSupplementary', array($aConf['table']['prefix'] . 'data_intermediate_ad_variable_value', $oComponent->getStatisticsMigration(), array('start' => $oStartDate, 'end' => $oEndDate)));
     $aMap = array();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogClick', 'logClick');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogImpression', 'logImpression');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oComponent =& OX_Component::factory('deliveryLog', 'oxLogRequest', 'logRequest');
     $aMap[get_class($oComponent)] = $oComponent->getStatisticsMigration();
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 08:00:00'", 'interval_end' => "'2008-08-28 08:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 11:01:00'")));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 09:00:00'", 'interval_end' => "'2008-08-28 09:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 11:01:00'")));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'summariseBucketsAggregate', array($aConf['table']['prefix'] . 'data_intermediate_ad', $aMap, array('start' => $oStartDate, 'end' => $oEndDate), array('operation_interval' => '60', 'operation_interval_id' => OX_OperationInterval::convertDateToOperationIntervalID($oStartDate), 'interval_start' => "'2008-08-28 10:00:00'", 'interval_end' => "'2008-08-28 10:59:59'", 'creative_id' => 0, 'updated' => "'2008-08-28 11:01:00'")));
     $oStartDate = new Date('2008-08-28 07:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 09:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(0, 'migrateRawRequests', array($oStartDate, $oEndDate));
     $oDal->expectAt(0, 'migrateRawImpressions', array($oStartDate, $oEndDate));
     $oDal->expectAt(0, 'migrateRawClicks', array($oStartDate, $oEndDate));
     $oStartDate = new Date('2008-08-28 08:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 10:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(1, 'migrateRawRequests', array($oStartDate, $oEndDate));
     $oDal->expectAt(1, 'migrateRawImpressions', array($oStartDate, $oEndDate));
     $oDal->expectAt(1, 'migrateRawClicks', array($oStartDate, $oEndDate));
     $oStartDate = new Date('2008-08-28 09:59:59');
     $oStartDate->addSeconds(1);
     $oEndDate = new Date('2008-08-28 11:00:00');
     $oEndDate->subtractSeconds(1);
     $oDal->expectAt(2, 'migrateRawRequests', array($oStartDate, $oEndDate));
     $oDal->expectAt(2, 'migrateRawImpressions', array($oStartDate, $oEndDate));
     $oDal->expectAt(2, 'migrateRawClicks', array($oStartDate, $oEndDate));
     $oDal->OX_Dal_Maintenance_Statistics();
     $oServiceLocator->register('OX_Dal_Maintenance_Statistics', $oDal);
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $oSummariseIntermediate->run();
     $oDal =& $oServiceLocator->get('OX_Dal_Maintenance_Statistics');
     $oDal->tally();
     $doApplication_variable = OA_Dal::factoryDO('application_variable');
     $doApplication_variable->name = 'mse_process_raw';
     $doApplication_variable->value = '1';
     $doApplication_variable->find();
     $rows = $doApplication_variable->getRowCount();
     $this->assertEqual($rows, 0);
     // Uninstall the installed plugins
     TestEnv::uninstallPluginPackage('openXDeliveryLog', false);
     // Reset the testing environment
     TestEnv::restoreEnv();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:SummariseIntermediateRun.mts.test.php

示例13: testPrepareActivateDeactivatePlacementEmail


//.........这里部分代码省略.........
     $expectedContents .= " Banner  [id{$bannerId1}] Test Banner\n\n";
     $expectedContents .= " Banner  [id{$bannerId2}] Test Banner\n";
     $expectedContents .= "  linked to: http://www.fornax.net/\n\n";
     $expectedContents .= "\n";
     $expectedContents .= "Regards,\n   {$agencyContact}, {$agencyName}";
     $this->assertTrue(is_array($aResult));
     $this->assertEqual(count($aResult), 2);
     $this->assertEqual($aResult['subject'], $expectedSubject);
     $this->assertEqual(str_replace("\r", "", $aResult['contents']), str_replace("\r", "", $expectedContents));
     // Check for a campaign that should be deactivated
     $expectedSubject = 'Campaign deactivated: Foo Client';
     $expectedContents = "Dear {$aAdvertiserUser['contact_name']},\n\n";
     $expectedContents .= 'Your campaign shown below has been deactivated because:' . "\n";
     $expectedContents .= '  - there are no Impressions remaining.' . "\n";
     $expectedContents .= "\nCampaign [id{$placementId}] Default Campaign\n";
     $expectedContents .= "http://{$aConf['webpath']['admin']}/stats.php?clientid={$advertiserId1}&campaignid={$placementId}&statsBreakdown=day&entity=campaign&breakdown=history&period_preset=all_stats&period_start=&period_end=\n";
     $expectedContents .= "=======================================================\n\n";
     $expectedContents .= " Banner  [id{$bannerId1}] Test Banner\n\n";
     $expectedContents .= " Banner  [id{$bannerId2}] Test Banner\n";
     $expectedContents .= "  linked to: http://www.fornax.net/\n\n";
     $expectedContents .= "\n";
     $expectedContents .= "Regards,\n   {$agencyContact}, {$agencyName}";
     $aResult = $oEmail->prepareCampaignActivatedDeactivatedEmail($aAdvertiserUser, $placementId, OX_CAMPAIGN_DISABLED_IMPRESSIONS);
     $this->assertTrue(is_array($aResult));
     $this->assertEqual(count($aResult), 2);
     $this->assertEqual($aResult['subject'], $expectedSubject);
     $this->assertEqual(str_replace("\r", "", $aResult['contents']), str_replace("\r", "", $expectedContents));
     $aResult = $oEmail->prepareCampaignActivatedDeactivatedEmail($aAdvertiserUser, $placementId, OX_CAMPAIGN_DISABLED_CLICKS);
     $expectedSubject = 'Campaign deactivated: Foo Client';
     $expectedContents = "Dear {$aAdvertiserUser['contact_name']},\n\n";
     $expectedContents .= 'Your campaign shown below has been deactivated because:' . "\n";
     $expectedContents .= '  - there are no Clicks remaining.' . "\n";
     $expectedContents .= "\nCampaign [id{$placementId}] Default Campaign\n";
     $expectedContents .= "http://{$aConf['webpath']['admin']}/stats.php?clientid={$advertiserId1}&campaignid={$placementId}&statsBreakdown=day&entity=campaign&breakdown=history&period_preset=all_stats&period_start=&period_end=\n";
     $expectedContents .= "=======================================================\n\n";
     $expectedContents .= " Banner  [id{$bannerId1}] Test Banner\n\n";
     $expectedContents .= " Banner  [id{$bannerId2}] Test Banner\n";
     $expectedContents .= "  linked to: http://www.fornax.net/\n\n";
     $expectedContents .= "\n";
     $expectedContents .= "Regards,\n   {$agencyContact}, {$agencyName}";
     $this->assertTrue(is_array($aResult));
     $this->assertEqual(count($aResult), 2);
     $this->assertEqual($aResult['subject'], $expectedSubject);
     $this->assertEqual(str_replace("\r", "", $aResult['contents']), str_replace("\r", "", $expectedContents));
     $aResult = $oEmail->prepareCampaignActivatedDeactivatedEmail($aAdvertiserUser, $placementId, OX_CAMPAIGN_DISABLED_CONVERSIONS);
     $expectedSubject = 'Campaign deactivated: Foo Client';
     $expectedContents = "Dear {$aAdvertiserUser['contact_name']},\n\n";
     $expectedContents .= 'Your campaign shown below has been deactivated because:' . "\n";
     $expectedContents .= '  - there are no Sales remaining.' . "\n";
     $expectedContents .= "\nCampaign [id{$placementId}] Default Campaign\n";
     $expectedContents .= "http://{$aConf['webpath']['admin']}/stats.php?clientid={$advertiserId1}&campaignid={$placementId}&statsBreakdown=day&entity=campaign&breakdown=history&period_preset=all_stats&period_start=&period_end=\n";
     $expectedContents .= "=======================================================\n\n";
     $expectedContents .= " Banner  [id{$bannerId1}] Test Banner\n\n";
     $expectedContents .= " Banner  [id{$bannerId2}] Test Banner\n";
     $expectedContents .= "  linked to: http://www.fornax.net/\n\n";
     $expectedContents .= "\n";
     $expectedContents .= "Regards,\n   {$agencyContact}, {$agencyName}";
     $this->assertTrue(is_array($aResult));
     $this->assertEqual(count($aResult), 2);
     $this->assertEqual($aResult['subject'], $expectedSubject);
     $this->assertEqual(str_replace("\r", "", $aResult['contents']), str_replace("\r", "", $expectedContents));
     $aResult = $oEmail->prepareCampaignActivatedDeactivatedEmail($aAdvertiserUser, $placementId, OX_CAMPAIGN_DISABLED_DATE);
     $expectedSubject = 'Campaign deactivated: Foo Client';
     $expectedContents = "Dear {$aAdvertiserUser['contact_name']},\n\n";
     $expectedContents .= 'Your campaign shown below has been deactivated because:' . "\n";
     $expectedContents .= '  - the expiration date has been reached.' . "\n";
     $expectedContents .= "\nCampaign [id{$placementId}] Default Campaign\n";
     $expectedContents .= "http://{$aConf['webpath']['admin']}/stats.php?clientid={$advertiserId1}&campaignid={$placementId}&statsBreakdown=day&entity=campaign&breakdown=history&period_preset=all_stats&period_start=&period_end=\n";
     $expectedContents .= "=======================================================\n\n";
     $expectedContents .= " Banner  [id{$bannerId1}] Test Banner\n\n";
     $expectedContents .= " Banner  [id{$bannerId2}] Test Banner\n";
     $expectedContents .= "  linked to: http://www.fornax.net/\n\n";
     $expectedContents .= "\n";
     $expectedContents .= "Regards,\n   {$agencyContact}, {$agencyName}";
     $this->assertTrue(is_array($aResult));
     $this->assertEqual(count($aResult), 2);
     $this->assertEqual($aResult['subject'], $expectedSubject);
     $this->assertEqual(str_replace("\r", "", $aResult['contents']), str_replace("\r", "", $expectedContents));
     $reason = 0 | OX_CAMPAIGN_DISABLED_IMPRESSIONS | OX_CAMPAIGN_DISABLED_CLICKS | OX_CAMPAIGN_DISABLED_DATE;
     $aResult = $oEmail->prepareCampaignActivatedDeactivatedEmail($aAdvertiserUser, $placementId, $reason);
     $expectedSubject = 'Campaign deactivated: Foo Client';
     $expectedContents = "Dear {$aAdvertiserUser['contact_name']},\n\n";
     $expectedContents .= 'Your campaign shown below has been deactivated because:' . "\n";
     $expectedContents .= '  - there are no Impressions remaining' . "\n";
     $expectedContents .= '  - there are no Clicks remaining' . "\n";
     $expectedContents .= '  - the expiration date has been reached.' . "\n";
     $expectedContents .= "\nCampaign [id{$placementId}] Default Campaign\n";
     $expectedContents .= "http://{$aConf['webpath']['admin']}/stats.php?clientid={$advertiserId1}&campaignid={$placementId}&statsBreakdown=day&entity=campaign&breakdown=history&period_preset=all_stats&period_start=&period_end=\n";
     $expectedContents .= "=======================================================\n\n";
     $expectedContents .= " Banner  [id{$bannerId1}] Test Banner\n\n";
     $expectedContents .= " Banner  [id{$bannerId2}] Test Banner\n";
     $expectedContents .= "  linked to: http://www.fornax.net/\n\n";
     $expectedContents .= "\n";
     $expectedContents .= "Regards,\n   {$agencyContact}, {$agencyName}";
     $this->assertTrue(is_array($aResult));
     $this->assertEqual(count($aResult), 2);
     $this->assertEqual($aResult['subject'], $expectedSubject);
     $this->assertEqual(str_replace("\r", "", $aResult['contents']), str_replace("\r", "", $expectedContents));
     TestEnv::restoreEnv();
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:101,代码来源:Email.mtc.test.php

示例14: test_locateComponents

 /**
  * A method to test the _locateComponents() method.
  */
 function test_locateComponents()
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     // Test 1: There are no deliveryLog group plugins installed, test that
     //         an empty array is returned
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $aComponents = $oSummariseIntermediate->_locateComponents();
     $this->assertTrue(is_array($aComponents));
     $this->assertTrue(empty($aComponents));
     // Setup the default OpenX delivery logging plugin for the next test
     TestEnv::installPluginPackage('openXDeliveryLog', false);
     // Test 2: Test with the default OpenX delivery logging plugin installed
     $oSummariseIntermediate = new OX_Maintenance_Statistics_Task_MigrateBucketData();
     $aComponents = $oSummariseIntermediate->_locateComponents();
     $this->assertTrue(is_array($aComponents));
     $this->assertEqual(count($aComponents), 3);
     $dia = $aConf['table']['prefix'] . 'data_intermediate_ad';
     $this->assertTrue(is_array($aComponents[$dia]));
     $this->assertEqual(count($aComponents[$dia]), 3);
     $aComponentClasses = array();
     foreach ($aComponents[$dia] as $oComponent) {
         $aComponentClasses[] = get_class($oComponent);
     }
     $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogRequest_LogRequest', $aComponentClasses));
     $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogImpression_LogImpression', $aComponentClasses));
     $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogClick_LogClick', $aComponentClasses));
     $diac = $aConf['table']['prefix'] . 'data_intermediate_ad_connection';
     $this->assertTrue(is_array($aComponents[$diac]));
     $this->assertEqual(count($aComponents[$diac]), 1);
     $aComponentClasses = array();
     foreach ($aComponents[$diac] as $oComponent) {
         $aComponentClasses[] = get_class($oComponent);
     }
     $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogConversion_LogConversion', $aComponentClasses));
     $diavv = $aConf['table']['prefix'] . 'data_intermediate_ad_variable_value';
     $this->assertTrue(is_array($aComponents[$diavv]));
     $this->assertEqual(count($aComponents[$diavv]), 1);
     $aComponentClasses = array();
     foreach ($aComponents[$diavv] as $oComponent) {
         $aComponentClasses[] = get_class($oComponent);
     }
     $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogConversion_LogConversionVariable', $aComponentClasses));
     /*
     TODO: move this test from core code to the plugin.  only bundled plugins (or the test plugin) can be used in core tests
             // Setup the default OpenX country based impression and click delivery logging plugin for the next test
             TestEnv::installPluginPackage('openXDeliveryLogCountry', false);
             // Test 3: Test with the default OpenX delivery logging plugin and the OpenX country based impression
             //         and click delivery logging plugin installed
             $aComponents = $oSummariseIntermediate->_locateComponents();
             $this->assertTrue(is_array($aComponents));
             $this->assertEqual(count($aComponents), 4);
             $dia = $aConf['table']['prefix'] . 'data_intermediate_ad';
             $this->assertTrue(is_array($aComponents[$dia]));
             $this->assertEqual(count($aComponents[$dia]), 4);
             $aComponentClasses = array();
             foreach ($aComponents[$dia] as $oComponent) {
                 $aComponentClasses[] = get_class($oComponent);
             }
             $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogRequest_LogRequest', $aComponentClasses));
             $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogImpression_LogImpression', $aComponentClasses));
             $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogClick_LogClick', $aComponentClasses));
             $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogImpression_logImpressionBackup', $aComponentClasses));
             $diac = $aConf['table']['prefix'] . 'data_intermediate_ad_connection';
             $this->assertTrue(is_array($aComponents[$diac]));
             $this->assertEqual(count($aComponents[$diac]), 1);
             $aComponentClasses = array();
             foreach ($aComponents[$diac] as $oComponent) {
                 $aComponentClasses[] = get_class($oComponent);
             }
             $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogConversion_LogConversion', $aComponentClasses));
             $diavv = $aConf['table']['prefix'] . 'data_intermediate_ad_variable_value';
             $this->assertTrue(is_array($aComponents[$diavv]));
             $this->assertEqual(count($aComponents[$diavv]), 1);
             $aComponentClasses = array();
             foreach ($aComponents[$diavv] as $oComponent) {
                 $aComponentClasses[] = get_class($oComponent);
             }
             $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogConversion_LogConversionVariable', $aComponentClasses));
             $sc = $aConf['table']['prefix'] . 'stats_country';
             $this->assertTrue(is_array($aComponents[$sc]));
             $this->assertEqual(count($aComponents[$sc]), 2);
             $aComponentClasses = array();
             foreach ($aComponents[$sc] as $oComponent) {
                 $aComponentClasses[] = get_class($oComponent);
             }
             $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogCountry_LogImpressionCountry', $aComponentClasses));
             $this->assertTrue(in_array('Plugins_DeliveryLog_OxLogCountry_LogClickCountry', $aComponentClasses));
             // Uninstall the installed plugins
             TestEnv::uninstallPluginPackage('openXDeliveryLogCountry', false);
     */
     // Uninstall the installed plugins
     TestEnv::uninstallPluginPackage('openXDeliveryLog', false);
     // Reset the testing environment
     TestEnv::restoreEnv();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:98,代码来源:SummariseIntermediate_locateComponents.mts.test.php

示例15: testSetMaintenanceStatisticsRunReport

 /**
  * Method to test the testSetMaintenanceStatisticsRunReport method.
  *
  * Requirements:
  * Test 1: Test two writes to reports.
  */
 function testSetMaintenanceStatisticsRunReport()
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     $oDbh =& OA_DB::singleton();
     // Create a new OX_Maintenance_Statistics_Task_LogCompletion object
     $oLogCompletion = new OX_Maintenance_Statistics_Task_LogCompletion();
     // Test 1
     $report = 'Maintenance run has finished :: Maintenance will run again at XYZ.';
     $oLogCompletion->_setMaintenanceStatisticsRunReport($report);
     $query = "\n            SELECT\n                timestamp,\n                usertype,\n                userid,\n                action,\n                object,\n                details\n            FROM\n                " . $oDbh->quoteIdentifier($aConf['table']['prefix'] . $aConf['table']['userlog'], true) . "\n            WHERE\n                userlogid = 1";
     $rc = $oDbh->query($query);
     $aRow = $rc->fetchRow();
     $this->assertEqual($aRow['usertype'], phpAds_userMaintenance);
     $this->assertEqual($aRow['userid'], '0');
     $this->assertEqual($aRow['action'], phpAds_actionBatchStatistics);
     $this->assertEqual($aRow['object'], '0');
     $this->assertEqual($aRow['details'], $report);
     $report = '2nd Maintenance run has finished :: Maintenance will run again at XYZ.';
     $oLogCompletion->_setMaintenanceStatisticsRunReport($report);
     $query = "\n            SELECT\n                timestamp,\n                usertype,\n                userid,\n                action,\n                object,\n                details\n            FROM\n                " . $oDbh->quoteIdentifier($aConf['table']['prefix'] . $aConf['table']['userlog'], true) . "\n            WHERE\n                userlogid = 2";
     $rc = $oDbh->query($query);
     $aRow = $rc->fetchRow();
     $this->assertEqual($aRow['usertype'], phpAds_userMaintenance);
     $this->assertEqual($aRow['userid'], '0');
     $this->assertEqual($aRow['action'], phpAds_actionBatchStatistics);
     $this->assertEqual($aRow['object'], '0');
     $this->assertEqual($aRow['details'], $report);
     TestEnv::restoreEnv();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:35,代码来源:LogCompletion.mts.test.php


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