public function testRankDown_指定されたデータがランクダウンされる() { SC_Helper_BestProducts_Ex::rankDown("1001"); $this->expected = "2"; $arrRet = SC_Helper_BestProducts_Ex::getBestProducts('1001'); $this->actual = $arrRet['rank']; $this->verify(); }
public function testRankDown_指定されたデータがランクダウンされる() { $objRecommend = new SC_Helper_BestProducts_Ex(); $objRecommend->rankDown("1001"); $this->expected = "2"; $arrRet = $objRecommend->getBestProducts('1001'); $this->actual = $arrRet['rank']; $this->verify(); }
/** * Page のアクション. * * @return void */ public function action() { $objFormParam = new SC_FormParam_Ex(); $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); $arrPost = $objFormParam->getHashArray(); $objRecommend = new SC_Helper_BestProducts_Ex(); switch ($this->getMode()) { case 'down': //商品の並び替えをする。 $objRecommend->rankDown($arrPost['best_id']); $arrItems = $this->getRecommendProducts($objRecommend); break; case 'up': //商品の並び替えをする。 $objRecommend->rankUp($arrPost['best_id']); $arrItems = $this->getRecommendProducts($objRecommend); break; case 'regist': // 商品を登録する。 $this->arrErr[$arrPost['rank']] = $this->lfCheckError($objFormParam); // 登録処理にエラーがあった場合は商品選択の時と同じ処理を行う。 if (SC_Utils_Ex::isBlank($this->arrErr)) { $member_id = $_SESSION['member_id']; $this->insertRecommendProduct($arrPost, $member_id, $objRecommend); $arrItems = $this->getRecommendProducts($objRecommend); $this->tpl_onload = "window.alert('編集が完了しました');"; } else { $arrItems = $this->getRecommendProducts($objRecommend); $rank = $arrPost['rank']; $arrItems[$rank]['comment'] = $arrPost['comment']; if ($arrPost['best_id']) { } else { $arrItems = $this->setProducts($arrPost, $arrItems); $this->checkRank = $arrPost['rank']; } } break; case 'delete': // 商品を削除する。 if ($arrPost['best_id']) { $this->deleteProduct($arrPost, $objRecommend); } $arrItems = $this->getRecommendProducts($objRecommend); $this->tpl_onload = "window.alert('削除しました');"; break; case 'set_item': // 商品を選択する。 $this->arrErr = $this->lfCheckError($objFormParam); if (SC_Utils_Ex::isBlank($this->arrErr['rank']) && SC_Utils_Ex::isBlank($this->arrErr['product_id'])) { $arrItems = $this->setProducts($arrPost, $this->getRecommendProducts($objRecommend)); $this->checkRank = $arrPost['rank']; } break; default: $arrItems = $this->getRecommendProducts($objRecommend); break; } $this->category_id = intval($arrPost['category_id']); $this->arrItems = $arrItems; // カテゴリ取得 $objDb = new SC_Helper_DB_Ex(); $this->arrCatList = $objDb->sfGetCategoryList('level = 1'); }