本文整理汇总了PHP中TestEnv::uninstallPluginPackage方法的典型用法代码示例。如果您正苦于以下问题:PHP TestEnv::uninstallPluginPackage方法的具体用法?PHP TestEnv::uninstallPluginPackage怎么用?PHP TestEnv::uninstallPluginPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestEnv
的用法示例。
在下文中一共展示了TestEnv::uninstallPluginPackage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
function tearDown()
{
// Uninstall the openXDeliveryLog plugin
TestEnv::uninstallPluginPackage('openXDeliveryLimitations', false);
// Clean up the testing environment
TestEnv::restoreEnv();
}
示例2: 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();
}
示例3: tearDown
function tearDown()
{
// Uninstall
TestEnv::uninstallPluginPackage('openXTests');
DataGenerator::cleanUp();
}
示例4: testHourly
//.........这里部分代码省略.........
$doData_intermediate_ad_variable_value->fetch();
$this->assertEqual($doData_intermediate_ad_variable_value->value, '1');
$doData_intermediate_ad_connection = OA_Dal::factoryDO('data_intermediate_ad_connection');
$doData_intermediate_ad_connection->server_raw_ip = 'localhost';
$doData_intermediate_ad_connection->server_raw_tracker_impression_id = 8;
$doData_intermediate_ad_connection->find();
$this->assertEqual($doData_intermediate_ad_connection->getRowCount(), 1);
$doData_intermediate_ad_connection->fetch();
$doData_intermediate_ad_variable_value = OA_Dal::factoryDO('data_intermediate_ad_variable_value');
$doData_intermediate_ad_variable_value->data_intermediate_ad_connection_id = $doData_intermediate_ad_connection->data_intermediate_ad_connection_id;
$doData_intermediate_ad_variable_value->find();
$this->assertEqual($doData_intermediate_ad_variable_value->getRowCount(), 2);
$doData_intermediate_ad_variable_value = OA_Dal::factoryDO('data_intermediate_ad_variable_value');
$doData_intermediate_ad_variable_value->data_intermediate_ad_connection_id = $doData_intermediate_ad_connection->data_intermediate_ad_connection_id;
$doData_intermediate_ad_variable_value->tracker_variable_id = 4;
$doData_intermediate_ad_variable_value->find();
$this->assertEqual($doData_intermediate_ad_variable_value->getRowCount(), 1);
$doData_intermediate_ad_variable_value->fetch();
$this->assertEqual($doData_intermediate_ad_variable_value->value, '0.99');
$doData_intermediate_ad_variable_value = OA_Dal::factoryDO('data_intermediate_ad_variable_value');
$doData_intermediate_ad_variable_value->data_intermediate_ad_connection_id = $doData_intermediate_ad_connection->data_intermediate_ad_connection_id;
$doData_intermediate_ad_variable_value->tracker_variable_id = 5;
$doData_intermediate_ad_variable_value->find();
$this->assertEqual($doData_intermediate_ad_variable_value->getRowCount(), 1);
$doData_intermediate_ad_variable_value->fetch();
$this->assertEqual($doData_intermediate_ad_variable_value->value, '99');
$doData_intermediate_ad = OA_Dal::factoryDO('data_intermediate_ad');
$doData_intermediate_ad->date_time = '2008-08-28 14:00:00';
$doData_intermediate_ad->ad_id = 1;
$doData_intermediate_ad->zone_id = 1;
$doData_intermediate_ad->find();
$this->assertEqual($doData_intermediate_ad->getRowCount(), 1);
$doData_intermediate_ad->fetch();
$this->assertEqual($doData_intermediate_ad->operation_interval, 60);
$this->assertEqual($doData_intermediate_ad->operation_interval_id, 110);
$this->assertEqual($doData_intermediate_ad->interval_start, '2008-08-28 14:00:00');
$this->assertEqual($doData_intermediate_ad->interval_end, '2008-08-28 14:59:59');
$this->assertEqual($doData_intermediate_ad->creative_id, 0);
$this->assertEqual($doData_intermediate_ad->requests, 1000);
$this->assertEqual($doData_intermediate_ad->impressions, 999);
$this->assertEqual($doData_intermediate_ad->clicks, 5);
$this->assertEqual($doData_intermediate_ad->conversions, 0);
$this->assertEqual($doData_intermediate_ad->total_basket_value, 0.0);
$this->assertEqual($doData_intermediate_ad->total_num_items, 0);
$doData_intermediate_ad = OA_Dal::factoryDO('data_intermediate_ad');
$doData_intermediate_ad->date_time = '2008-08-28 15:00:00';
$doData_intermediate_ad->ad_id = 1;
$doData_intermediate_ad->zone_id = 1;
$doData_intermediate_ad->find();
$this->assertEqual($doData_intermediate_ad->getRowCount(), 1);
$doData_intermediate_ad->fetch();
$this->assertEqual($doData_intermediate_ad->operation_interval, 60);
$this->assertEqual($doData_intermediate_ad->operation_interval_id, 111);
$this->assertEqual($doData_intermediate_ad->interval_start, '2008-08-28 15:00:00');
$this->assertEqual($doData_intermediate_ad->interval_end, '2008-08-28 15:59:59');
$this->assertEqual($doData_intermediate_ad->creative_id, 0);
$this->assertEqual($doData_intermediate_ad->requests, 1100);
$this->assertEqual($doData_intermediate_ad->impressions, 1099);
$this->assertEqual($doData_intermediate_ad->clicks, 8);
$this->assertEqual($doData_intermediate_ad->conversions, 6);
$this->assertEqual($doData_intermediate_ad->total_basket_value, 130.98);
$this->assertEqual($doData_intermediate_ad->total_num_items, 100);
$doData_summary_ad_hourly = OA_Dal::factoryDO('data_summary_ad_hourly');
$doData_summary_ad_hourly->date_time = '2008-08-28 14:00:00';
$doData_summary_ad_hourly->ad_id = 1;
$doData_summary_ad_hourly->zone_id = 1;
$doData_summary_ad_hourly->find();
$this->assertEqual($doData_summary_ad_hourly->getRowCount(), 1);
$doData_summary_ad_hourly->fetch();
$this->assertEqual($doData_summary_ad_hourly->creative_id, 0);
$this->assertEqual($doData_summary_ad_hourly->requests, 1000);
$this->assertEqual($doData_summary_ad_hourly->impressions, 999);
$this->assertEqual($doData_summary_ad_hourly->clicks, 5);
$this->assertEqual($doData_summary_ad_hourly->conversions, 0);
$this->assertEqual($doData_summary_ad_hourly->total_basket_value, 0.0);
$this->assertEqual($doData_summary_ad_hourly->total_num_items, 0);
$this->assertNull($doData_summary_ad_hourly->total_revenue);
$this->assertNull($doData_summary_ad_hourly->total_cost);
$this->assertNull($doData_summary_ad_hourly->total_techcost);
$doData_summary_ad_hourly = OA_Dal::factoryDO('data_summary_ad_hourly');
$doData_summary_ad_hourly->date_time = '2008-08-28 15:00:00';
$doData_summary_ad_hourly->ad_id = 1;
$doData_summary_ad_hourly->zone_id = 1;
$doData_summary_ad_hourly->find();
$this->assertEqual($doData_summary_ad_hourly->getRowCount(), 1);
$doData_summary_ad_hourly->fetch();
$this->assertEqual($doData_summary_ad_hourly->creative_id, 0);
$this->assertEqual($doData_summary_ad_hourly->requests, 1100);
$this->assertEqual($doData_summary_ad_hourly->impressions, 1099);
$this->assertEqual($doData_summary_ad_hourly->clicks, 8);
$this->assertEqual($doData_summary_ad_hourly->conversions, 6);
$this->assertEqual($doData_summary_ad_hourly->total_basket_value, 130.98);
$this->assertEqual($doData_summary_ad_hourly->total_num_items, 100);
$this->assertNull($doData_summary_ad_hourly->total_revenue);
$this->assertNull($doData_summary_ad_hourly->total_cost);
$this->assertNull($doData_summary_ad_hourly->total_techcost);
/**********************************************************************/
// Remove the installed plugin
TestEnv::uninstallPluginPackage('openXDeliveryLog', false);
}
示例5: testGenerateTags
function testGenerateTags()
{
if (!$this->zoneId) {
return;
}
TestEnv::uninstallPluginPackage('openXInvocationTags');
TestEnv::installPluginPackage('openXInvocationTags');
$this->expectError();
$this->assertFalse($this->oApi->generateTags(-1, 'foo'));
$this->expectError();
$this->assertFalse($this->oApi->generateTags($this->zoneId, 'foo'));
$tag1 = $this->oApi->generateTags($this->zoneId, 'adjs');
$tag2 = $this->oApi->generateTags($this->zoneId, 'adjs', array('source' => 'x'));
$this->assertTrue($tag1);
$this->assertTrue($tag2);
$this->assertNotEqual($tag1, $tag2);
TestEnv::uninstallPluginPackage('openXInvocationTags');
}
示例6: testSummariseBucketsRaw
//.........这里部分代码省略.........
$oData_intermediate_ad_connection = OA_Dal::factoryDO('data_intermediate_ad_connection');
$oData_intermediate_ad_connection->server_raw_tracker_impression_id = 2;
$oData_intermediate_ad_connection->server_raw_ip = 'localhost';
$oData_intermediate_ad_connection->find();
$rows = $oData_intermediate_ad_connection->getRowCount();
$this->assertEqual($rows, 1);
$oData_intermediate_ad_connection->fetch();
$this->assertEqual($oData_intermediate_ad_connection->data_intermediate_ad_connection_id, 1);
$this->assertEqual($oData_intermediate_ad_connection->server_raw_tracker_impression_id, 2);
$this->assertEqual($oData_intermediate_ad_connection->server_raw_ip, 'localhost');
$this->assertEqual($oData_intermediate_ad_connection->tracker_id, 2);
$this->assertEqual($oData_intermediate_ad_connection->tracker_date_time, '2008-08-21 09:15:00');
$this->assertEqual($oData_intermediate_ad_connection->connection_date_time, '2008-08-21 08:15:00');
$this->assertEqual($oData_intermediate_ad_connection->ad_id, 3);
$this->assertEqual($oData_intermediate_ad_connection->zone_id, 4);
$this->assertEqual($oData_intermediate_ad_connection->tracker_ip_address, '127.0.0.1');
$this->assertEqual($oData_intermediate_ad_connection->connection_action, MAX_CONNECTION_AD_CLICK);
$this->assertEqual($oData_intermediate_ad_connection->connection_window, 3600);
$this->assertEqual($oData_intermediate_ad_connection->connection_status, MAX_CONNECTION_STATUS_APPROVED);
$this->assertEqual($oData_intermediate_ad_connection->inside_window, 1);
// Clean up generated data
DataGenerator::cleanUp();
// Insert some (new) data into the data_bkt_a table in the
// correct operation interval
$oData_bkt_a = OA_Dal::factoryDO('data_bkt_a');
$oData_bkt_a->server_conv_id = 3;
$oData_bkt_a->server_ip = 'localhost';
$oData_bkt_a->tracker_id = 5;
$oData_bkt_a->date_time = '2008-08-21 09:30:00';
$oData_bkt_a->action_date_time = '2008-08-21 08:59:00';
$oData_bkt_a->creative_id = 8;
$oData_bkt_a->zone_id = 9;
$oData_bkt_a->ip_address = '127.0.0.1';
$oData_bkt_a->action = MAX_CONNECTION_AD_IMPRESSION;
$oData_bkt_a->window = 1920;
$oData_bkt_a->status = MAX_CONNECTION_STATUS_PENDING;
$conversionId = DataGenerator::generateOne($oData_bkt_a);
// Test 11: Test again with data in the correct operation interval
$result = $oDalMaintenanceStatistics->summariseBucketsRaw($statisticsTableName, $aMigrationDetails, $aDates);
$this->assertEqual($result, 1);
$oData_intermediate_ad_connection = OA_Dal::factoryDO('data_intermediate_ad_connection');
$oData_intermediate_ad_connection->find();
$rows = $oData_intermediate_ad_connection->getRowCount();
$this->assertEqual($rows, 2);
$oData_intermediate_ad_connection = OA_Dal::factoryDO('data_intermediate_ad_connection');
$oData_intermediate_ad_connection->server_raw_tracker_impression_id = 2;
$oData_intermediate_ad_connection->server_raw_ip = 'localhost';
$oData_intermediate_ad_connection->find();
$rows = $oData_intermediate_ad_connection->getRowCount();
$this->assertEqual($rows, 1);
$oData_intermediate_ad_connection->fetch();
$this->assertEqual($oData_intermediate_ad_connection->data_intermediate_ad_connection_id, 1);
$this->assertEqual($oData_intermediate_ad_connection->server_raw_tracker_impression_id, 2);
$this->assertEqual($oData_intermediate_ad_connection->server_raw_ip, 'localhost');
$this->assertEqual($oData_intermediate_ad_connection->tracker_id, 2);
$this->assertEqual($oData_intermediate_ad_connection->tracker_date_time, '2008-08-21 09:15:00');
$this->assertEqual($oData_intermediate_ad_connection->connection_date_time, '2008-08-21 08:15:00');
$this->assertEqual($oData_intermediate_ad_connection->ad_id, 3);
$this->assertEqual($oData_intermediate_ad_connection->zone_id, 4);
$this->assertEqual($oData_intermediate_ad_connection->tracker_ip_address, '127.0.0.1');
$this->assertEqual($oData_intermediate_ad_connection->connection_action, MAX_CONNECTION_AD_CLICK);
$this->assertEqual($oData_intermediate_ad_connection->connection_window, 3600);
$this->assertEqual($oData_intermediate_ad_connection->connection_status, MAX_CONNECTION_STATUS_APPROVED);
$this->assertEqual($oData_intermediate_ad_connection->inside_window, 1);
$oData_intermediate_ad_connection = OA_Dal::factoryDO('data_intermediate_ad_connection');
$oData_intermediate_ad_connection->server_raw_tracker_impression_id = 3;
$oData_intermediate_ad_connection->server_raw_ip = 'localhost';
$oData_intermediate_ad_connection->find();
$rows = $oData_intermediate_ad_connection->getRowCount();
$this->assertEqual($rows, 1);
$oData_intermediate_ad_connection->fetch();
$this->assertEqual($oData_intermediate_ad_connection->data_intermediate_ad_connection_id, 2);
$this->assertEqual($oData_intermediate_ad_connection->server_raw_tracker_impression_id, 3);
$this->assertEqual($oData_intermediate_ad_connection->server_raw_ip, 'localhost');
$this->assertEqual($oData_intermediate_ad_connection->tracker_id, 5);
$this->assertEqual($oData_intermediate_ad_connection->tracker_date_time, '2008-08-21 09:30:00');
$this->assertEqual($oData_intermediate_ad_connection->connection_date_time, '2008-08-21 08:59:00');
$this->assertEqual($oData_intermediate_ad_connection->ad_id, 8);
$this->assertEqual($oData_intermediate_ad_connection->zone_id, 9);
$this->assertEqual($oData_intermediate_ad_connection->tracker_ip_address, '127.0.0.1');
$this->assertEqual($oData_intermediate_ad_connection->connection_action, MAX_CONNECTION_AD_IMPRESSION);
$this->assertEqual($oData_intermediate_ad_connection->connection_window, 1920);
$this->assertEqual($oData_intermediate_ad_connection->connection_status, MAX_CONNECTION_STATUS_PENDING);
$this->assertEqual($oData_intermediate_ad_connection->inside_window, 1);
// Clean up generated data
DataGenerator::cleanUp();
// Also clean up the data migrated into the statistics table
$oData_intermediate_ad_connection = OA_Dal::factoryDO('data_intermediate_ad_connection');
$oData_intermediate_ad_connection->server_raw_tracker_impression_id = 2;
$oData_intermediate_ad_connection->find();
$oData_intermediate_ad_connection->delete();
$oData_intermediate_ad_connection = OA_Dal::factoryDO('data_intermediate_ad_connection');
$oData_intermediate_ad_connection->server_raw_tracker_impression_id = 3;
$oData_intermediate_ad_connection->find();
$oData_intermediate_ad_connection->delete();
// Uninstall the installed plugin
TestEnv::uninstallPluginPackage('openXDeliveryLog', false);
// Restore the test environment configuration
TestEnv::restoreConfig();
}
示例7: testSummariseBucketsRawSupplementary
//.........这里部分代码省略.........
$oData_intermediate_ad_connection->connection_window = 3600;
$oData_intermediate_ad_connection->connection_status = MAX_CONNECTION_STATUS_APPROVED;
$oData_intermediate_ad_connection->inside_window = 1;
$conversionId1 = DataGenerator::generateOne($oData_intermediate_ad_connection);
$oData_intermediate_ad_connection = OA_Dal::factoryDO('data_intermediate_ad_connection');
$oData_intermediate_ad_connection->server_raw_tracker_impression_id = 3;
$oData_intermediate_ad_connection->server_raw_ip = 'localhost';
$oData_intermediate_ad_connection->tracker_id = 9;
$oData_intermediate_ad_connection->tracker_date_time = '2008-08-21 09:16:00';
$oData_intermediate_ad_connection->connection_date_time = '2008-08-21 08:16:00';
$oData_intermediate_ad_connection->ad_id = 6;
$oData_intermediate_ad_connection->zone_id = 7;
$oData_intermediate_ad_connection->tracker_ip_address = '127.0.0.1';
$oData_intermediate_ad_connection->connection_action = MAX_CONNECTION_AD_VIEW;
$oData_intermediate_ad_connection->connection_window = 3600;
$oData_intermediate_ad_connection->connection_status = MAX_CONNECTION_STATUS_APPROVED;
$oData_intermediate_ad_connection->inside_window = 1;
$conversionId2 = DataGenerator::generateOne($oData_intermediate_ad_connection);
// Test 12: Test with data in the correct operation interval, but
// no supplementary data
$result = $oDalMaintenanceStatistics->summariseBucketsRawSupplementary($statisticsTableName, $aMigrationDetails, $aDates);
$this->assertEqual($result, 0);
// Add some supplementary data for the conversions above!
$oData_bkt_a_var = OA_Dal::factoryDO('data_bkt_a_var');
$oData_bkt_a_var->server_conv_id = 2;
$oData_bkt_a_var->server_ip = 'localhost';
$oData_bkt_a_var->tracker_variable_id = 99;
$oData_bkt_a_var->value = 'foo';
DataGenerator::generateOne($oData_bkt_a_var);
$oData_bkt_a_var = OA_Dal::factoryDO('data_bkt_a_var');
$oData_bkt_a_var->server_conv_id = 2;
$oData_bkt_a_var->server_ip = 'localhost';
$oData_bkt_a_var->tracker_variable_id = 100;
$oData_bkt_a_var->value = '156.99';
DataGenerator::generateOne($oData_bkt_a_var);
$oData_bkt_a_var = OA_Dal::factoryDO('data_bkt_a_var');
$oData_bkt_a_var->server_conv_id = 3;
$oData_bkt_a_var->server_ip = 'localhost';
$oData_bkt_a_var->tracker_variable_id = 15;
$oData_bkt_a_var->value = '123456789';
DataGenerator::generateOne($oData_bkt_a_var);
// Test 12: Test with data in the correct operation interval
$result = $oDalMaintenanceStatistics->summariseBucketsRawSupplementary($statisticsTableName, $aMigrationDetails, $aDates);
$this->assertEqual($result, 3);
$oData_intermediate_ad_variable_value = OA_Dal::factoryDO('data_intermediate_ad_variable_value');
$oData_intermediate_ad_variable_value->data_intermediate_ad_connection_id = $conversionId1;
$oData_intermediate_ad_variable_value->find();
$rows = $oData_intermediate_ad_variable_value->getRowCount();
$this->assertEqual($rows, 2);
$oData_intermediate_ad_variable_value = OA_Dal::factoryDO('data_intermediate_ad_variable_value');
$oData_intermediate_ad_variable_value->data_intermediate_ad_connection_id = $conversionId1;
$oData_intermediate_ad_variable_value->tracker_variable_id = 99;
$oData_intermediate_ad_variable_value->find();
$rows = $oData_intermediate_ad_variable_value->getRowCount();
$this->assertEqual($rows, 1);
$oData_intermediate_ad_variable_value->fetch();
$this->assertEqual($oData_intermediate_ad_variable_value->data_intermediate_ad_connection_id, $conversionId1);
$this->assertEqual($oData_intermediate_ad_variable_value->tracker_variable_id, 99);
$this->assertEqual($oData_intermediate_ad_variable_value->value, 'foo');
$oData_intermediate_ad_variable_value = OA_Dal::factoryDO('data_intermediate_ad_variable_value');
$oData_intermediate_ad_variable_value->data_intermediate_ad_connection_id = $conversionId1;
$oData_intermediate_ad_variable_value->tracker_variable_id = 100;
$oData_intermediate_ad_variable_value->find();
$rows = $oData_intermediate_ad_variable_value->getRowCount();
$this->assertEqual($rows, 1);
$oData_intermediate_ad_variable_value->fetch();
$this->assertEqual($oData_intermediate_ad_variable_value->data_intermediate_ad_connection_id, $conversionId1);
$this->assertEqual($oData_intermediate_ad_variable_value->tracker_variable_id, 100);
$this->assertEqual($oData_intermediate_ad_variable_value->value, '156.99');
$oData_intermediate_ad_variable_value = OA_Dal::factoryDO('data_intermediate_ad_variable_value');
$oData_intermediate_ad_variable_value->data_intermediate_ad_connection_id = $conversionId2;
$oData_intermediate_ad_variable_value->find();
$rows = $oData_intermediate_ad_variable_value->getRowCount();
$this->assertEqual($rows, 1);
$oData_intermediate_ad_variable_value = OA_Dal::factoryDO('data_intermediate_ad_variable_value');
$oData_intermediate_ad_variable_value->data_intermediate_ad_connection_id = $conversionId2;
$oData_intermediate_ad_variable_value->tracker_variable_id = 15;
$oData_intermediate_ad_variable_value->find();
$rows = $oData_intermediate_ad_variable_value->getRowCount();
$this->assertEqual($rows, 1);
$oData_intermediate_ad_variable_value->fetch();
$this->assertEqual($oData_intermediate_ad_variable_value->data_intermediate_ad_connection_id, $conversionId2);
$this->assertEqual($oData_intermediate_ad_variable_value->tracker_variable_id, 15);
$this->assertEqual($oData_intermediate_ad_variable_value->value, '123456789');
// Clean up generated data
DataGenerator::cleanUp();
// Also clean up the data migrated into the statistics table
$oData_intermediate_ad_variable_value = OA_Dal::factoryDO('data_intermediate_ad_connection');
$oData_intermediate_ad_variable_value->data_intermediate_ad_connection_id = $conversionId1;
$oData_intermediate_ad_variable_value->find();
$oData_intermediate_ad_variable_value->delete();
$oData_intermediate_ad_variable_value = OA_Dal::factoryDO('data_intermediate_ad_connection');
$oData_intermediate_ad_variable_value->data_intermediate_ad_connection_id = $conversionId2;
$oData_intermediate_ad_variable_value->find();
$oData_intermediate_ad_variable_value->delete();
// Uninstall the installed plugin
TestEnv::uninstallPluginPackage('openXDeliveryLog', false);
// Restore the test environment configuration
TestEnv::restoreConfig();
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:Statistics_summariseBucketsRawSupplementary.dal.test.php
示例8: test_MAX_Delivery_log_logConversion
//.........这里部分代码省略.........
$oConversionDate = new Date();
$oConversionDate->copy($oNowDate);
$oConversionDate->subtractSeconds(60);
$_SERVER['REMOTE_ADDR'] = '127.0.0.99';
// 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');
$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
$aConversion = array('action_type' => MAX_CONNECTION_AD_CLICK, 'tracker_type' => MAX_CONNECTION_TYPE_SALE, 'status' => MAX_CONNECTION_STATUS_APPROVED, 'cid' => 2, 'zid' => 3, 'dt' => $GLOBALS['_MAX']['NOW'] - 60, 'window' => 60);
MAX_Delivery_log_logConversion(1, $aConversion);
// 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');
$this->assertTrue($tableExists);
// Ensure that there are is nothing logged in the data bucket table
$doData_bkt_a = OA_Dal::factoryDO('data_bkt_a');
$doData_bkt_a->find();
$rows = $doData_bkt_a->getRowCount();
$this->assertEqual($rows, 0);
// Call the conversion logging function
$aConversionInfo = MAX_Delivery_log_logConversion(1, $aConversion);
// Ensure that the data was logged correctly
$doData_bkt_a = OA_Dal::factoryDO('data_bkt_a');
$doData_bkt_a->find();
$rows = $doData_bkt_a->getRowCount();
$this->assertEqual($rows, 1);
$doData_bkt_a = OA_Dal::factoryDO('data_bkt_a');
$doData_bkt_a->server_conv_id = 1;
$doData_bkt_a->find();
$rows = $doData_bkt_a->getRowCount();
$this->assertEqual($rows, 1);
$doData_bkt_a->fetch();
$this->assertEqual($doData_bkt_a->server_ip, 'singleDB');
$this->assertEqual($doData_bkt_a->tracker_id, 1);
$this->assertEqual($doData_bkt_a->date_time, $oNowDate->format('%Y-%m-%d %H:%M:%S'));
$this->assertEqual($doData_bkt_a->action_date_time, $oConversionDate->format('%Y-%m-%d %H:%M:%S'));
$this->assertEqual($doData_bkt_a->creative_id, 2);
$this->assertEqual($doData_bkt_a->zone_id, 3);
$this->assertEqual($doData_bkt_a->ip_address, '127.0.0.99');
$this->assertEqual($doData_bkt_a->action, MAX_CONNECTION_AD_CLICK);
$this->assertEqual($doData_bkt_a->window, 60);
$this->assertEqual($doData_bkt_a->status, MAX_CONNECTION_STATUS_APPROVED);
$this->assertTrue(is_array($aConversionInfo));
$this->assertTrue(is_array($aConversionInfo['deliveryLog:oxLogConversion:logConversion']));
$this->assertEqual($aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_conv_id'], 1);
$this->assertEqual($aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_raw_ip'], 'singleDB');
$aConversion['cid'] = 5;
// Call the conversion logging function
$aConversionInfo = MAX_Delivery_log_logConversion(1, $aConversion);
// Ensure that the data was logged correctly
$doData_bkt_a = OA_Dal::factoryDO('data_bkt_a');
$doData_bkt_a->find();
$rows = $doData_bkt_a->getRowCount();
$this->assertEqual($rows, 2);
$doData_bkt_a = OA_Dal::factoryDO('data_bkt_a');
$doData_bkt_a->server_conv_id = 1;
$doData_bkt_a->find();
$rows = $doData_bkt_a->getRowCount();
$this->assertEqual($rows, 1);
$doData_bkt_a->fetch();
$this->assertEqual($doData_bkt_a->server_ip, 'singleDB');
$this->assertEqual($doData_bkt_a->tracker_id, 1);
$this->assertEqual($doData_bkt_a->date_time, $oNowDate->format('%Y-%m-%d %H:%M:%S'));
$this->assertEqual($doData_bkt_a->action_date_time, $oConversionDate->format('%Y-%m-%d %H:%M:%S'));
$this->assertEqual($doData_bkt_a->creative_id, 2);
$this->assertEqual($doData_bkt_a->zone_id, 3);
$this->assertEqual($doData_bkt_a->ip_address, '127.0.0.99');
$this->assertEqual($doData_bkt_a->action, MAX_CONNECTION_AD_CLICK);
$this->assertEqual($doData_bkt_a->window, 60);
$this->assertEqual($doData_bkt_a->status, MAX_CONNECTION_STATUS_APPROVED);
$doData_bkt_a = OA_Dal::factoryDO('data_bkt_a');
$doData_bkt_a->server_conv_id = 2;
$doData_bkt_a->find();
$rows = $doData_bkt_a->getRowCount();
$this->assertEqual($rows, 1);
$doData_bkt_a->fetch();
$this->assertEqual($doData_bkt_a->server_ip, 'singleDB');
$this->assertEqual($doData_bkt_a->tracker_id, 1);
$this->assertEqual($doData_bkt_a->date_time, $oNowDate->format('%Y-%m-%d %H:%M:%S'));
$this->assertEqual($doData_bkt_a->action_date_time, $oConversionDate->format('%Y-%m-%d %H:%M:%S'));
$this->assertEqual($doData_bkt_a->creative_id, 5);
$this->assertEqual($doData_bkt_a->zone_id, 3);
$this->assertEqual($doData_bkt_a->ip_address, '127.0.0.99');
$this->assertEqual($doData_bkt_a->action, MAX_CONNECTION_AD_CLICK);
$this->assertEqual($doData_bkt_a->window, 60);
$this->assertEqual($doData_bkt_a->status, MAX_CONNECTION_STATUS_APPROVED);
$this->assertTrue(is_array($aConversionInfo));
$this->assertTrue(is_array($aConversionInfo['deliveryLog:oxLogConversion:logConversion']));
$this->assertEqual($aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_conv_id'], 2);
$this->assertEqual($aConversionInfo['deliveryLog:oxLogConversion:logConversion']['server_raw_ip'], 'singleDB');
// Uninstall the openXDeliveryLog plugin
TestEnv::uninstallPluginPackage('openXDeliveryLog', false);
// Restore the test configuration file
TestEnv::restoreConfig();
}
示例9: testCallStaticMethod
/**
* A method to test the callStaticMethod() method.
*/
function testCallStaticMethod()
{
// Set the error handling class' handleErrors() method as
// the error handler for PHP for this test.
$oTestErrorHandler = new TestErrorHandler();
PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array(&$oTestErrorHandler, 'handleErrors'));
// Test with a bad module/package
$return = MAX_Plugin::callStaticMethod('foo', 'bar', null, 'foo');
$this->assertEqual(count($oTestErrorHandler->aErrors), 1);
$this->assertEqual($oTestErrorHandler->aErrors[0]->message, 'Unable to include the file ' . MAX_PATH . '/plugins/foo/bar/bar' . MAX_PLUGINS_EXTENSION . '.');
$this->assertFalse($result);
$oTestErrorHandler->reset();
// Unset the error handler
PEAR::popErrorHandling();
// Set the error handling class' handleErrors() method as
// the error handler for PHP for this test.
$oTestErrorHandler = new TestErrorHandler();
PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array(&$oTestErrorHandler, 'handleErrors'));
// Test with a bad method
$return = MAX_Plugin::callStaticMethod('reports', 'standard', 'advertisingAnalysisReport', 'foo');
$this->assertEqual(count($oTestErrorHandler->aErrors), 1);
$this->assertEqual($oTestErrorHandler->aErrors[0]->message, "Method 'foo()' not defined in class 'Plugins_Reports_Standard_AdvertisingAnalysisReport'.");
$this->assertFalse($result);
$oTestErrorHandler->reset();
// Unset the error handler
PEAR::popErrorHandling();
unset($GLOBALS['_MAX']['CONF']['plugins']['openXTests']);
unset($GLOBALS['_MAX']['CONF']['pluginGroupComponents']['Dummy']);
TestEnv::installPluginPackage('openXTests');
// Test with a real method, no parameters
$return = OX_Component::callStaticMethod('deliveryLimitations', 'Dummy', 'Dummy', 'isAllowed');
$this->assertTrue($return);
// Test with a real method, with parameters
$return = OX_Component::callStaticMethod('deliveryLimitations', 'Dummy', 'Dummy', 'isAllowed', 'disallow');
$this->assertFalse($return);
TestEnv::uninstallPluginPackage('openXTests');
}
示例10: tearDown
function tearDown()
{
$_COOKIE = $this->tmpCookie;
// Uninstall
TestEnv::uninstallPluginPackage('openXTests');
}
示例11: test_exportPlugin
function test_exportPlugin()
{
TestEnv::installPluginPackage('openXTests', false);
$pathPackages = $GLOBALS['_MAX']['CONF']['pluginPaths']['packages'];
$pathPlugins = $GLOBALS['_MAX']['CONF']['pluginPaths']['plugins'];
$pathAdmin = $GLOBALS['_MAX']['CONF']['pluginPaths']['admin'];
$oExport = new OX_PluginExport();
$oExport->init('openXTests');
$pathExport = $oExport->outputDir;
@unlink($pathExport . 'openXTests.zip');
$this->assertTrue($oExport->exportPlugin('openXTests'));
$baseDir = MAX_PATH . '/var/tmp/openXTests';
$this->assertTrue(file_exists($pathExport . 'openXTests.zip'));
$oZip = new PclZip($pathExport . 'openXTests.zip');
$aContents = $oZip->listContent();
$this->assertIsA($aContents, 'array');
$this->assertEqual(count($aContents), 4);
$this->assertEqual($aContents[0]['status'], 'ok');
$this->assertEqual($aContents[0]['filename'], ltrim($pathPackages, '/') . 'Dummy/Dummy.xml');
$this->assertEqual($aContents[0]['stored_filename'], ltrim($pathPackages, '/') . 'Dummy/Dummy.xml');
$this->assertEqual($aContents[1]['status'], 'ok');
$this->assertEqual($aContents[1]['filename'], ltrim($pathPlugins, '/') . 'deliveryLimitations/Dummy/Dummy.class.php');
$this->assertEqual($aContents[1]['stored_filename'], ltrim($pathPlugins, '/') . 'deliveryLimitations/Dummy/Dummy.class.php');
$this->assertEqual($aContents[2]['status'], 'ok');
$this->assertEqual($aContents[2]['filename'], ltrim($pathPlugins, '/') . 'deliveryLimitations/Dummy/Dummy.delivery.php');
$this->assertEqual($aContents[2]['stored_filename'], ltrim($pathPlugins, '/') . 'deliveryLimitations/Dummy/Dummy.delivery.php');
$this->assertEqual($aContents[3]['status'], 'ok');
$this->assertEqual($aContents[3]['filename'], ltrim($pathPackages, '/') . 'openXTests.xml');
$this->assertEqual($aContents[3]['stored_filename'], ltrim($pathPackages, '/') . 'openXTests.xml');
@unlink($pathExport . 'openXTests.zip');
$aContentsNew = $aContents;
$oZip = new PclZip(MAX_PATH . '/plugins_repo/release/openXTests.zip');
$aContentsOld = $oZip->listContent();
foreach ($aContentsOld as $i => $aItemOld) {
if (!$aItemOld['folder']) {
foreach ($aContentsNew as $n => $aItemNew) {
if ($aItemOld['filename'] == $aItemNew['filename'] && $aItemOld['stored_filename'] == $aItemNew['stored_filename'] && $aItemOld['size'] == $aItemNew['size'] && $aItemOld['crc'] == $aItemNew['crc']) {
unset($aContentsOld[$i]);
unset($aContentsNew[$n]);
break;
}
}
} else {
// For somewhat reason "new" doesn't seem to contain folders. Bug?
unset($aContentsOld[$i]);
}
}
$this->assertFalse(count($aContentsNew));
$this->assertFalse(count($aContentsOld));
TestEnv::uninstallPluginPackage('openXTests', false);
TestEnv::restoreConfig();
}
示例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();
}
示例13: testGetAllowedTags
function testGetAllowedTags()
{
TestEnv::installPluginPackage('openXInvocationTags');
$dllZone = new OA_Dll_Zone();
$aZoneAllowedTags = $dllZone->getAllowedTags();
// Test if only and all allowed tags are returned
$count = 0;
$invocationTags =& OX_Component::getComponents('invocationTags');
foreach ($invocationTags as $pluginKey => $invocationTag) {
if ($invocationTag->isAllowed(null, null)) {
$count++;
$this->assertTrue(in_array($pluginKey, $aZoneAllowedTags));
} else {
$this->assertFalse(in_array($pluginKey, $aZoneAllowedTags));
}
}
$this->assertEqual($count, count($aZoneAllowedTags));
// tests if spc is disallowed anyway
$GLOBALS['_MAX']['CONF']['spc']['allowed'] = true;
$aZoneAllowedTags = $dllZone->getAllowedTags();
$this->assertFalse(in_array('spc', $aZoneAllowedTags));
unset($GLOBALS['_MAX']['CONF']['spc']['allowed']);
TestEnv::uninstallPluginPackage('openXInvocationTags');
}
示例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: tearDown
function tearDown()
{
TestEnv::uninstallPluginPackage('openXDeliveryCacheStore');
}