function process_filter_form_empty() { $auction_set = array(); $short = array('auctionId' => 2, "title" => "title", "description" => "description", "currentPrice" => 10, "stars" => 1, "category_id" => 5); $short_spaces = array('auctionId' => 3, "title" => "title with spaces", "description" => "description with spaces", "currentPrice" => 10, "stars" => 2, "category_id" => 5); $different = array('auctionId' => 4, "title" => "different", "description" => "same description", "currentPrice" => 10, "stars" => 3, "category_id" => 5); $costly = array('auctionId' => 5, "title" => "auction with long description", "description" => "very long description", "currentPrice" => 100, "stars" => 4, "category_id" => 5); $wrong_category = array('auctionId' => 5, "title" => "auction with long description", "description" => "very long description", "currentPrice" => 100, "stars" => 4, "category_id" => 1000); array_push($auction_set, $short, $short_spaces, $different, $costly); $result = process_filter_form($auction_set, 50, 200, 5, 5); assert(empty($result)); echo "Auctions list after filtering: "; echo "<pre>"; echo "Should print null just below: "; print_r($result); echo "<br/>Should print null just above: "; echo "</pre>"; }
//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']; } $auction_set = process_filter_form($auction_set, $_POST['bottom'], $_POST['top'], $_POST['rating'], $_POST['category']); //begin constructing auction set display table, id value used by //jQuery to replace construct with ajax request response //begin constructing table $output = "\n <table class=\"search-page-table table-striped\" id=\"results\">\n <col width=\"200px\">\n <col width=\"400px\">\n <col width=\"800px\">"; //if (filtered if requested) result set is not empty: if ($auction_set) { foreach ($auction_set as $auction) { $imageName = htmlentities($auction['imageName']); $title = htmlentities($auction['title']); $auctionId = htmlentities($auction['auctionId']); $currentPrice = htmlentities($auction['currentPrice']); $description = htmlentities($auction['description']); $rating_string = "The seller has not yet been rated<br/>"; if ($auction['no_of_ratings'] > 0) { $rating = htmlentities($auction['stars']);