本文整理汇总了PHP中DataGenerator::resetSequence方法的典型用法代码示例。如果您正苦于以下问题:PHP DataGenerator::resetSequence方法的具体用法?PHP DataGenerator::resetSequence怎么用?PHP DataGenerator::resetSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataGenerator
的用法示例。
在下文中一共展示了DataGenerator::resetSequence方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetAllDeliveryLimitationsByTypeId
/**
* A method to test the getAllDeliveryLimitationsByTypeId() method.
*
* Requirements:
* Test 1: Test for ad limitations with no data, and ensure null returned
* Test 2: Test for channel limitations with no data, and ensure null returned
* Test 3: Test with an ad limitation for an ad, but with a different ad id, and
* ensure null returned
* Test 4: Test with an ad limitation, but with a channel id, and ensure null
* returned
* Test 5: Test with an ad limitation, but with a bad $type, and ensure null
* returned
* Test 6: Test with an ad limitation, and ensure values returned
* Test 7: Test with a channel limitation, but with an ad id, and ensure null
* returned
* Test 8: Test with a channel limitation, but with a different channel id, and
* ensure null returned
* Test 9: Test with a channel limitation, but with a bad $type, and ensure null
* returned
* Test 10: Test with a channel limitation, and ensure values returned
*/
function testGetAllDeliveryLimitationsByTypeId()
{
$aConf = $GLOBALS['_MAX']['CONF'];
$oDbh =& OA_DB::singleton();
$oDalMaintenanceCommon = new OA_Dal_Maintenance_Common();
// Test 1
$aResult = $oDalMaintenanceCommon->getAllDeliveryLimitationsByTypeId(1, 'ad');
$this->assertNull($aResult);
// Test 2
$aResult = $oDalMaintenanceCommon->getAllDeliveryLimitationsByTypeId(1, 'channel');
$this->assertNull($aResult);
$table = $aConf['table']['prefix'] . $aConf['table']['acls'];
$query = "\n INSERT INTO\n " . $oDbh->quoteIdentifier($table, true) . "\n (\n bannerid,\n logical,\n type,\n comparison,\n data,\n executionorder\n )\n VALUES\n (?, ?, ?, ?, ?, ?)";
$aTypes = array('integer', 'text', 'text', 'text', 'text', 'integer');
$st = $oDbh->prepare($query, $aTypes, MDB2_PREPARE_MANIP);
$aData = array(3, 'and', 'Time:Date', '!=', '2005-05-25', 0);
$rows = $st->execute($aData);
$aData = array(3, 'and', 'Geo:Country', '==', 'GB', 1);
$rows = $st->execute($aData);
// Test 3
$aResult = $oDalMaintenanceCommon->getAllDeliveryLimitationsByTypeId(1, 'ad');
$this->assertNull($aResult);
// Test 4
$aResult = $oDalMaintenanceCommon->getAllDeliveryLimitationsByTypeId(1, 'channel');
$this->assertNull($aResult);
// Test 5
$aResult = $oDalMaintenanceCommon->getAllDeliveryLimitationsByTypeId(3, 'foo');
$this->assertNull($aResult);
// Test 6
$aResult = $oDalMaintenanceCommon->getAllDeliveryLimitationsByTypeId(3, 'ad');
$this->assertTrue(is_array($aResult));
$this->assertEqual(count($aResult), 2);
$this->assertEqual(count($aResult[0]), 6);
$this->assertEqual($aResult[0]['ad_id'], 3);
$this->assertEqual($aResult[0]['logical'], 'and');
$this->assertEqual($aResult[0]['type'], 'Time:Date');
$this->assertEqual($aResult[0]['comparison'], '!=');
$this->assertEqual($aResult[0]['data'], '2005-05-25');
$this->assertEqual($aResult[0]['executionorder'], 0);
$this->assertEqual(count($aResult[1]), 6);
$this->assertEqual($aResult[1]['ad_id'], 3);
$this->assertEqual($aResult[1]['logical'], 'and');
$this->assertEqual($aResult[1]['type'], 'Geo:Country');
$this->assertEqual($aResult[1]['comparison'], '==');
$this->assertEqual($aResult[1]['data'], 'GB');
$this->assertEqual($aResult[1]['executionorder'], 1);
$aCleanupTables = array($aConf['table']['acls']);
foreach ($aCleanupTables as $table) {
$query = "DELETE FROM {$aConf['table']['prefix']}{$table}";
$oDbh->exec($query);
}
DataGenerator::resetSequence($aCleanupTables);
TestEnv::restoreEnv();
$table = $aConf['table']['prefix'] . $aConf['table']['acls_channel'];
$query = "\n INSERT INTO\n " . $oDbh->quoteIdentifier($table, true) . "\n (\n channelid,\n logical,\n type,\n comparison,\n data,\n executionorder\n )\n VALUES\n (?, ?, ?, ?, ?, ?)";
$aTypes = array('integer', 'text', 'text', 'text', 'text', 'integer');
$st = $oDbh->prepare($query, $aTypes, MDB2_PREPARE_MANIP);
$aData = array(3, 'and', 'Time:Date', '!=', '2005-05-25', 0);
$rows = $st->execute($aData);
$aData = array(3, 'and', 'Geo:Country', '==', 'GB', 1);
$rows = $st->execute($aData);
// Test 7
$aResult = $oDalMaintenanceCommon->getAllDeliveryLimitationsByTypeId(1, 'ad');
$this->assertNull($aResult);
// Test 8
$aResult = $oDalMaintenanceCommon->getAllDeliveryLimitationsByTypeId(1, 'channel');
$this->assertNull($aResult);
// Test 9
$aResult = $oDalMaintenanceCommon->getAllDeliveryLimitationsByTypeId(3, 'foo');
$this->assertNull($aResult);
// Test 10
$aResult = $oDalMaintenanceCommon->getAllDeliveryLimitationsByTypeId(3, 'channel');
$this->assertTrue(is_array($aResult));
$this->assertEqual(count($aResult), 2);
$this->assertEqual(count($aResult[0]), 6);
$this->assertEqual($aResult[0]['ad_id'], 3);
$this->assertEqual($aResult[0]['logical'], 'and');
$this->assertEqual($aResult[0]['type'], 'Time:Date');
$this->assertEqual($aResult[0]['comparison'], '!=');
//.........这里部分代码省略.........
示例2: cleanUp
/**
* Remove the data from all tables where DataGenerator generated any records,
* and also reset the auditing account ownership cache.
*
* @param array $addTablesToCleanUp Array of any additional tables DataGenerator should
* delete data from
* @access public
* @static
*/
function cleanUp($addTablesToCleanUp = array())
{
$tables = DataGenerator::trackData();
$tables = array_merge($tables, $addTablesToCleanUp);
foreach ($tables as $table) {
$do = OA_Dal::factoryDO($table);
$do->whereAdd('1=1');
$do->delete($useWhere = true);
DataGenerator::resetSequence($table);
}
// Cleanup ancestor ids
DataGenerator::getReferenceId();
// Clean up the auditing account ownership cache
$doAccounts = OA_Dal::factoryDO('accounts');
$doAccounts->getOwningAccountIds(null, null, true);
}