function retrieve_followed_by_user() { $auction_set = query_select_followed_by_user($_SESSION['userId']); for ($i = 0; $i < sizeof($auction_set); $i++) { //append the result of get_price($auctionId, $auctionStartingPrice) to //each auction associative array $winning_bid = get_price_with_buyer_id($auction_set[$i]['auctionId'], $auction_set[$i]['startingPrice']); $auction_set[$i]['winning_price'] = $winning_bid['value']; $auction_set[$i]['winner_id'] = $winning_bid['user_id']; } return $auction_set; }
function get_price_success() { global $connection; $result_set = query_select_followed_by_user(38); $found_expected = 0; foreach ($result_set as $auction) { if ($auction['auctionId'] && get_price($auction['auctionId'], $auction['startingPrice']) == EXPECTED_PRICE_FOR_AUCTION_5) { $found_expected = 1; break; } } assert($found_expected); }
function query_select_followed_by_user_failure() { $userId = 272; $result = query_select_followed_by_user($userId); assert(!$result); }