require_once "../includes/form_processing.php"; require_once "../includes/queries.php"; require_once "../includes/dbconnection.php"; //process filtering if set as part of the get request, this modifies the //auction_set if (isset($_POST['bottom']) && isset($_POST['top']) && isset($_POST['rating']) && isset($_POST['category']) && isset($_POST['auctionSet']) && isset($_POST['tokenChanged'])) { //initialize to empty array $auction_set = array(); if ($_POST['tokenChanged']) { //process search form $search_token = trim($_POST['token']); //process_search_form();//uses GET from inside the body //if processed search token is not empty if ($search_token) { //query database and modify result set with further queries $auction_set = query_select_auction_search($search_token); for ($i = 0; $i < sizeof($auction_set); $i++) { //enrich with price $current_price = get_price($auction_set[$i]['auctionId'], $auction_set[$i]['startingPrice']); $auction_set[$i]['currentPrice'] = $current_price; //once the current price is known, there is no further need for a //startingPrice field on the retrieved associative array unset($auction_set[$i]['startingPrice']); //enrich with rating $feedback_array = query_select_user_rating($auction_set[$i]['seller']); $auction_set[$i]['stars'] = $feedback_array['stars']; $auction_set[$i]['no_of_ratings'] = $feedback_array['occurrences']; } } } else { $auction_set = $_POST['auctionSet'];
function get_price_failure() { global $connection; $result_set = query_select_auction_search("different"); foreach ($result_set as $auction) { //assert((get_price($auction) == 10)); assert(get_price($auction['auctionId'], $auction['startingPrice']) == 10); } }
function query_select_auction_search_success() { $token = "title"; assert(query_select_auction_search($token)); $token = "itl"; assert(query_select_auction_search($token)); $token = "TITLE"; assert(query_select_auction_search($token)); $token = "tItLe"; assert(query_select_auction_search($token)); $token = "descr"; assert(query_select_auction_search($token)); //warning: does it match on empty? //should be caught by form processing $token = ""; assert(query_select_auction_search($token)); $token = " "; assert(query_select_auction_search($token)); }