/** * A method to test the getDeliveryLimitationsByChannelId() method. * * Requirements: * Test 1: Test with invalid input, and ensure nothing returned * Test 2: Test with nothing in the database, and ensure nothing returned * Test 3: Test with delivery limitations attached to channel NOT desired, and * ensure nothing returned * Test 4: Test with delivery limitations attached to the channel desired, and * ensure they are returned */ function testGetDeliveryLimitationsByChannelId() { $conf = $GLOBALS['_MAX']['CONF']; $oDbh =& OA_DB::singleton(); $oDal = new MAX_Dal_Entities(); // Test 1 $channelId = 'foo'; $aResult = $oDal->getDeliveryLimitationsByChannelId($channelId); $this->assertNull($aResult); // Test 2 $channelId = 1; $aResult = $oDal->getDeliveryLimitationsByChannelId($channelId); $this->assertNull($aResult); // Test 3 $aData = array(2, 'and', 'Time:Hour', '==', 12, 0); $idAclsChannel1 = $this->_insertAclsChannel($aData); $aResult = $oDal->getDeliveryLimitationsByChannelId(1); $this->assertNull($aResult); DataGenerator::cleanUp(); // Test 4 $aData = array(1, 'and', 'Time:Hour', '==', 10, 0); $idAclsChannel1 = $this->_insertAclsChannel($aData); $aData = array(1, 'or', 'Time:Hour', '==', 11, 1); $idAclsChannel2 = $this->_insertAclsChannel($aData); $aData = array(2, 'and', 'Time:Hour', '==', 12, 0); $idAclsChannel3 = $this->_insertAclsChannel($aData); $aResult = $oDal->getDeliveryLimitationsByChannelId(1); $aExpectedResult = array(0 => array('logical' => 'and', 'type' => 'Time:Hour', 'comparison' => '==', 'data' => 10), 1 => array('logical' => 'or', 'type' => 'Time:Hour', 'comparison' => '==', 'data' => 11)); $this->assertEqual($aResult, $aExpectedResult); DataGenerator::cleanUp(); }
/** * A method to set the placement's "aAds" array to contain the * (@link OA_Maintenance_Priority_Ad} objects for each ad in the placement, * from the data stored in the database. */ function setAdverts() { $aAds = $this->oMaxDalEntities->getAdsByCampaignId($this->id); if (is_array($aAds) && count($aAds) > 0) { reset($aAds); while (list($adId, $aAdDetails) = each($aAds)) { $this->aAds[$adId] = new OA_Maintenance_Priority_Ad($aAdDetails); } } }