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


PHP TestEnv::dropTempTables方法代码示例

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


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

示例1: testSaveAllocatedImpressions

 /**
  * A method to test the saveAllocatedImpressions method.
  */
 function testSaveAllocatedImpressions()
 {
     $oDbh =& OA_DB::singleton();
     $oDal = new OA_Dal_Maintenance_Priority();
     // Create the required temporary table for the tests
     $oTable =& OA_DB_Table_Priority::singleton();
     $oTable->createTable('tmp_ad_zone_impression');
     // Prepare the test data
     $aData = array(array('ad_id' => 56, 'zone_id' => 11, 'required_impressions' => 9997, 'requested_impressions' => 9000), array('ad_id' => 56, 'zone_id' => 12, 'required_impressions' => 24, 'requested_impressions' => 24));
     $result = $oDal->saveAllocatedImpressions($aData);
     $query = "SELECT * FROM " . $oDbh->quoteIdentifier('tmp_ad_zone_impression', true) . " ORDER BY ad_id, zone_id";
     $rc = $oDbh->query($query);
     $result = $rc->fetchAll();
     $this->assertTrue(is_array($result));
     $this->assertTrue(count($result) == 2);
     $tmp = $result[0];
     $this->assertTrue(array_key_exists('ad_id', $tmp));
     $this->assertEqual($tmp['ad_id'], 56);
     $this->assertTrue(array_key_exists('zone_id', $tmp));
     $this->assertEqual($tmp['zone_id'], 11);
     $this->assertTrue(array_key_exists('required_impressions', $tmp));
     $this->assertEqual($tmp['required_impressions'], 9997);
     $this->assertTrue(array_key_exists('requested_impressions', $tmp));
     $this->assertEqual($tmp['requested_impressions'], 9000);
     $tmp = $result[1];
     $this->assertTrue(array_key_exists('ad_id', $tmp));
     $this->assertEqual($tmp['ad_id'], 56);
     $this->assertTrue(array_key_exists('zone_id', $tmp));
     $this->assertEqual($tmp['zone_id'], 12);
     $this->assertTrue(array_key_exists('required_impressions', $tmp));
     $this->assertEqual($tmp['required_impressions'], 24);
     $this->assertTrue(array_key_exists('requested_impressions', $tmp));
     $this->assertEqual($tmp['requested_impressions'], 24);
     TestEnv::dropTempTables();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:38,代码来源:Priority_AdImpressions.dal.test.php

示例2: _testBatchInsert

 function _testBatchInsert($method)
 {
     $oTable =& OA_DB_Table_Priority::singleton();
     $oTable->createTable('tmp_ad_required_impression');
     $this->assertEqual(array(), $this->_getbatchInsertRecords());
     $aData = array(array('ad_id' => '23', 'required_impressions' => '140'), array('ad_id' => '29', 'required_impressions' => '120'));
     $result = OA_Dal::$method('tmp_ad_required_impression', array('ad_id', 'required_impressions'), $aData);
     $this->assertEqual($result, 2);
     $result = $this->_getbatchInsertRecords();
     $this->assertTrue(count($result) == 2);
     $this->assertEqual($result, $aData);
     $oneMoreRow = array(array(100, 2));
     $result = OA_Dal::$method('tmp_ad_required_impression', array('ad_id', 'required_impressions'), $oneMoreRow);
     $this->assertEqual($result, 1);
     $result = $this->_getbatchInsertRecords();
     $this->assertTrue(count($result) == 3);
     $this->assertEqual($result, array_merge($aData, array(array('ad_id' => 100, 'required_impressions' => 2))));
     TestEnv::dropTempTables();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:19,代码来源:Dal.dal.test.php

示例3: DEPRECATED_testGetAllZonesWithAllocInv

 /**
  * Method to test the getAllZonesWithAllocInv 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 DEPRECATED_testGetAllZonesWithAllocInv()
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $oDbh =& OA_DB::singleton();
     $oMaxDalMaintenance = new OA_Dal_Maintenance_Priority();
     // Create the required temporary table for the tests
     $oTable =& OA_DB_Table_Priority::singleton();
     $oTable->createTable('tmp_ad_zone_impression');
     $tableTmp = $oDbh->quoteIdentifier('tmp_ad_zone_impression', true);
     // Test 1
     $result =& $oMaxDalMaintenance->getAllZonesWithAllocInv();
     $this->assertEqual(count($result), 0);
     // Test 2
     $query = "\n            INSERT INTO\n                {$tableTmp}\n                (\n                    ad_id,\n                    zone_id,\n                    required_impressions,\n                    requested_impressions\n                )\n            VALUES\n                (\n                    1,\n                    1,\n                    2,\n                    3\n                )";
     $rows = $oDbh->exec($query);
     $query = "\n            INSERT INTO\n                {$tableTmp}\n                (\n                    ad_id,\n                    zone_id,\n                    required_impressions,\n                    requested_impressions\n                )\n            VALUES\n                (\n                    1,\n                    2,\n                    4,\n                    5\n                )";
     $rows = $oDbh->exec($query);
     $query = "\n            INSERT INTO\n                {$tableTmp}\n                (\n                    ad_id,\n                    zone_id,\n                    required_impressions,\n                    requested_impressions\n                )\n            VALUES\n                (\n                    2,\n                    2,\n                    6,\n                    7\n                )";
     $rows = $oDbh->exec($query);
     $result =& $oMaxDalMaintenance->getAllZonesWithAllocInv();
     $this->assertEqual(count($result), 3);
     $this->assertEqual($result[0]['zone_id'], 1);
     $this->assertEqual($result[0]['ad_id'], 1);
     $this->assertEqual($result[0]['required_impressions'], 2);
     $this->assertEqual($result[0]['requested_impressions'], 3);
     $this->assertEqual($result[1]['zone_id'], 2);
     $this->assertEqual($result[1]['ad_id'], 1);
     $this->assertEqual($result[1]['required_impressions'], 4);
     $this->assertEqual($result[1]['requested_impressions'], 5);
     $this->assertEqual($result[2]['zone_id'], 2);
     $this->assertEqual($result[2]['ad_id'], 2);
     $this->assertEqual($result[2]['required_impressions'], 6);
     $this->assertEqual($result[2]['requested_impressions'], 7);
     TestEnv::dropTempTables();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:42,代码来源:Priority_getAllZonesWithAllocInv.dal.test.php

示例4: restoreEnv

 /**
  * A method for restoring the testing environment database setup.
  * This method can normaly be avoided by using transactions to
  * rollback database changes during testing, but sometimes a
  * DROP TEMPORARY TABLE (for example) is used during testing,
  * causing any transaction to be committed. In this case, this
  * method is needed to re-set the testing database.
  */
 static function restoreEnv($dropTmpTables = 'false')
 {
     $oDbh =& OA_DB::singleton();
     // Rollback any transactions that have not been closed
     // (Naughty, naughty test!)
     while ($oDbh->inTransaction(true) || $oDbh->inTransaction()) {
         TestEnv::rollbackTransaction();
     }
     if ($dropTmpTables) {
         TestEnv::dropTempTables();
     }
     // Truncate all known core tables
     $oTable =& OA_DB_Table_Core::singleton();
     $oTable->truncateAllTables();
     // Reset all database sequences
     $oTable->resetAllSequences();
     // Destroy the service locator
     $oServiceLocator =& OA_ServiceLocator::instance();
     unset($oServiceLocator->aService);
     // Re-set up the test environment
     TestRunner::setupEnv($GLOBALS['_MAX']['TEST']['layerEnv'], true);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:30,代码来源:TestEnv.php


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