/** * 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(); }