Ignore:
Timestamp:
2013/03/09 23:43:23 (11 years ago)
Author:
hiro151
Message:

#2183 SC_Helper_BestProductsクラスのテストコード(途中)

Location:
branches/camp/camp-2_13-tests
Files:
3 added
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/camp/camp-2_13-tests/data/class/helper/SC_Helper_BestProducts.php

    r22625 r22656  
    104104     * @return multiple 登録成功:おすすめ商品ID, 失敗:FALSE 
    105105     */ 
    106     public function save($sqlval) 
     106    public function saveBestProducts($sqlval) 
    107107    { 
    108108        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
  • branches/camp/camp-2_13-tests/data/class/pages/admin/contents/LC_Page_Admin_Contents_Recommend.php

    r22625 r22656  
    214214        $sqlval['comment'] = $arrPost['comment']; 
    215215        $sqlval['creator_id'] = $member_id; 
    216         $objRecommend->save($sqlval); 
     216        $objRecommend->saveBestProducts($sqlval); 
    217217    } 
    218218 
  • branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_BestProducts/SC_Helper_BestProducts_TestBase.php

    r22567 r22656  
    2525 */ 
    2626/** 
    27  * SC_Helper_Purchaseのテストの基底クラス. 
     27 * SC_Helper_BestProductsのテストの基底クラス. 
    2828 * 
    2929 * 
    30  * @author Hiroko Tamagawa 
     30 * @author hiroshi kakuta 
    3131 * @version $Id$ 
    3232 */ 
    33 class SC_Helper_Purchase_TestBase extends Common_TestCase 
     33class SC_Helper_BestProducts_TestBase extends Common_TestCase 
    3434{ 
    3535 
    36   protected function setUp() 
    37   { 
    38     parent::setUp(); 
    39   } 
    40  
    41   protected function tearDown() 
    42   { 
    43     parent::tearDown(); 
    44   } 
    45  
    46   ///////////////////////////////////////// 
    47   /** 
    48    * セッションに配送情報を設定します。 
    49    */ 
    50   protected function setUpShipping($shipping) 
    51   { 
    52     if (!$shipping) { 
    53       $shipping = $this->getSingleShipping();  
     36    protected function setUp() 
     37    { 
     38        parent::setUp(); 
    5439    } 
    5540 
    56     $_SESSION['shipping'] = $shipping; 
    57   } 
     41    protected function tearDown() 
     42    { 
     43        parent::tearDown(); 
     44    } 
    5845 
    59   protected function getSingleShipping() 
    60   { 
    61     return array( 
    62       '00001' => array( 
    63         'shipment_id' => '00001', 
    64         'shipment_item' => '商品1', 
    65         'shipping_pref' => '東京都') 
    66     ); 
    67   } 
    6846 
    69   protected function getMultipleShipping() 
    70   { 
    71     return array( 
    72       '00001' => array( 
    73         'shipment_id' => '00001', 
    74         'shipment_item' => array('商品1'), 
    75         'shipping_pref' => '東京都'), 
    76       '00002' => array( 
    77         'shipment_id' => '00002', 
    78         'shipment_item' => array('商品2'), 
    79         'shipping_pref' => '沖縄県'), 
    80       '00003' => array( 
    81         'shipment_id' => '00003', 
    82         'shipment_item' => array(), 
    83         'shipping_pref' => '埼玉県') 
    84     ); 
    85   } 
     47    /** 
     48     * DBにお勧め情報を登録します. 
     49     */ 
     50    protected function setUpBestProducts() 
     51    { 
     52        $products = array( 
     53            array( 
     54                'best_id' => '1001', 
     55                'product_id'=>'2', 
     56                'category_id' => '0', 
     57                'rank' => '1', 
     58                'title' => 'タイトルですよ', 
     59                'comment' => 'コメントですよ', 
     60                'creator_id' => '1', 
     61                'create_date' => '2000-01-01 00:00:00', 
     62                'update_date' => '2000-01-01 00:00:00', 
     63                'del_flg' => '0' 
     64            ), 
     65            array( 
     66                'best_id' => '1002', 
     67                'product_id'=>'1', 
     68                'category_id' => '0', 
     69                'rank' => '2', 
     70                'title' => 'タイトルですよ', 
     71                'comment' => 'コメントですよ', 
     72                'creator_id' => '1', 
     73                'create_date' => '2000-01-01 00:00:00', 
     74                'update_date' => '2000-01-01 00:00:00', 
     75                'del_flg' => '1' 
     76            ), 
     77            array( 
     78                'best_id' => '1003', 
     79                'product_id'=>'3', 
     80                'category_id' => '1', 
     81                'rank' => '3', 
     82                'title' => 'タイトルですよ3', 
     83                'comment' => 'コメントですよ3', 
     84                'creator_id' => '3', 
     85                'create_date' => '2000-01-01 00:00:00', 
     86                'update_date' => '2000-01-01 00:00:00', 
     87                'del_flg' => '0' 
     88            ) 
     89        ); 
    8690 
    87   /** 
    88    * DBに配送情報を設定します。 
    89    */ 
    90   protected function setUpShippingOnDb() 
    91   { 
    92     $shippings = array( 
    93       array( 
    94         'update_date' => '2000-01-01 00:00:00', 
    95         'shipping_id' => '1', 
    96         'order_id' => '1', 
    97         'shipping_name01' => '配送情報01', 
    98         'shipping_date' => '2012-01-12' 
    99       ), 
    100       array( 
    101         'update_date' => '2000-01-01 00:00:00', 
    102         'shipping_id' => '2', 
    103         'order_id' => '2', 
    104         'shipping_name01' => '配送情報02', 
    105         'shipping_date' => '2011-10-01' 
    106       ), 
    107       array( 
    108         'update_date' => '2000-01-01 00:00:00', 
    109         'shipping_id' => '1002', 
    110         'order_id' => '1002', 
    111         'shipping_time' => '午後', 
    112         'time_id' => '1' 
    113       ) 
    114     ); 
     91        $this->objQuery->delete('dtb_best_products'); 
     92        foreach ($products as  $item) { 
     93            $this->objQuery->insert('dtb_best_products', $item); 
     94        } 
     95    } 
    11596 
    116     $this->objQuery->delete('dtb_shipping'); 
    117     foreach ($shippings as $key => $item) { 
    118       $this->objQuery->insert('dtb_shipping', $item); 
     97    //dtb_best_productsを全て削除する 
     98    protected function deleteAllBestProducts(){ 
     99        $this->objQuery->delete('dtb_best_products'); 
    119100    } 
    120   } 
    121  
    122   /** 
    123    * DBに配送商品情報を設定します。 
    124    */ 
    125   protected function setUpShipmentItem() 
    126   { 
    127       $shipping_items = array( 
    128         array( 
    129           'shipping_id' => '1', 
    130           'product_class_id' => '1001', 
    131           'order_id' => '1', 
    132           'product_name' => '商品名01', 
    133           'price' => '1500' 
    134         ), 
    135         array( 
    136           'shipping_id' => '1', 
    137           'product_class_id' => '1002', 
    138           'order_id' => '1', 
    139           'product_name' => '商品名02', 
    140           'price' => '2400' 
    141         ) 
    142       ); 
    143  
    144     $this->objQuery->delete('dtb_shipment_item'); 
    145     foreach ($shipping_items as $key => $item) { 
    146       $this->objQuery->insert('dtb_shipment_item', $item); 
    147     } 
    148     $this->setUpProductClass(); 
    149   } 
    150  
    151   /** 
    152    * DBに商品クラス情報を設定します. 
    153    */ 
    154   protected function setUpProductClass() 
    155   { 
    156       $product_class = array( 
    157         array( 
    158           'update_date' => '2000-01-01 00:00:00', 
    159           'product_class_id' => '1001', 
    160           'product_id' => '1001', 
    161           'product_type_id' => '1', 
    162           'product_code' => 'code1001', 
    163           'classcategory_id1' => '1001', 
    164           'classcategory_id2' => '1002', 
    165           'price01' => '1500', 
    166           'price02' => '1500', 
    167           'creator_id' => '1', 
    168           'stock' => '100', 
    169           'del_flg' => '0' 
    170         ), 
    171         array( 
    172           'update_date' => '2000-01-01 00:00:00', 
    173           'product_class_id' => '1002', 
    174           'product_id' => '1002', 
    175           'product_type_id' => '2', 
    176           'price02' => '2500', 
    177           'creator_id' => '1', 
    178           'stock' => '50', 
    179           'del_flg' => '0' 
    180         ) 
    181       ); 
    182  
    183     $this->objQuery->delete('dtb_products_class'); 
    184     foreach ($product_class as $key => $item) 
    185 { 
    186       $this->objQuery->insert('dtb_products_class', $item); 
    187     } 
    188     $this->setUpClassCategory(); 
    189     $this->setUpProducts(); 
    190   } 
    191  
    192   /** 
    193    * DBに製品カテゴリ情報を登録します. 
    194    */ 
    195   protected function setUpClassCategory() 
    196   { 
    197     $class_category = array( 
    198       array( 
    199         'update_date' => '2000-01-01 00:00:00', 
    200         'classcategory_id' => '1001', 
    201         'class_id' => '1', 
    202         'creator_id' => '1', 
    203         'name' => 'cat1001' 
    204       ), 
    205       array( 
    206         'update_date' => '2000-01-01 00:00:00', 
    207         'classcategory_id' => '1002', 
    208         'class_id' => '1', 
    209         'creator_id' => '1', 
    210         'name' => 'cat1002' 
    211       ) 
    212     ); 
    213  
    214     $this->objQuery->delete('dtb_classcategory'); 
    215     foreach ($class_category as $key => $item) { 
    216       $this->objQuery->insert('dtb_classcategory', $item); 
    217     } 
    218   } 
    219  
    220   /**  
    221    * DBに製品情報を登録します. 
    222    */ 
    223  protected function setUpProducts() 
    224  { 
    225    $products = array( 
    226      array( 
    227        'update_date' => '2000-01-01 00:00:00', 
    228        'product_id' => '1001', 
    229        'name' => '製品名1001', 
    230        'del_flg' => '0', 
    231        'creator_id' => '1', 
    232        'status' => '1' 
    233      ), 
    234      array( 
    235        'update_date' => '2000-01-01 00:00:00', 
    236        'product_id' => '1002', 
    237        'name' => '製品名1002', 
    238        'del_flg' => '0', 
    239        'creator_id' => '1', 
    240        'status' => '2' 
    241      ) 
    242    ); 
    243  
    244    $this->objQuery->delete('dtb_products'); 
    245    foreach ($products as $key => $item) { 
    246      $this->objQuery->insert('dtb_products', $item); 
    247    } 
    248  } 
    249  
    250  /** 
    251   * DBに支払方法の情報を登録します. 
    252   */ 
    253  protected function setUpPaymentOptions() 
    254  { 
    255    $payment_options = array( 
    256      array( 
    257        'deliv_id' => '2001', 
    258        'payment_id' => '2001', 
    259        'rank' => '1' 
    260      ), 
    261      array( 
    262        'deliv_id' => '1001', 
    263        'payment_id' => '1001', 
    264        'rank' => '2' 
    265      ), 
    266      array( 
    267        'deliv_id' => '1001', 
    268        'payment_id' => '1002', 
    269        'rank' => '1' 
    270      ), 
    271      array( 
    272        'deliv_id' => '1003', 
    273        'payment_id' => '3001', 
    274        'rank' => '1' 
    275      ), 
    276      array( 
    277        'deliv_id' => '1003', 
    278        'payment_id' => '3002', 
    279        'rank' => '2' 
    280      ), 
    281      array( 
    282        'deliv_id' => '1003', 
    283        'payment_id' => '3003', 
    284        'rank' => '3' 
    285      ), 
    286      array( 
    287        'deliv_id' => '1003', 
    288        'payment_id' => '3004', 
    289        'rank' => '4' 
    290      ), 
    291      array( 
    292        'deliv_id' => '1003', 
    293        'payment_id' => '3005', 
    294        'rank' => '5' 
    295      ) 
    296    ); 
    297  
    298    $this->objQuery->delete('dtb_payment_options'); 
    299    foreach ($payment_options as $key => $item) { 
    300      $this->objQuery->insert('dtb_payment_options', $item); 
    301    } 
    302  } 
    303   
    304  /** 
    305   * DBに配送業者の情報を登録します. 
    306   */ 
    307  protected function setUpDeliv() 
    308  { 
    309    $deliv = array( 
    310      array(  // 削除フラグON 
    311        'deliv_id' => '2001', 
    312        'product_type_id' => '1001', 
    313        'name' => '配送業者del', 
    314        'rank' => '1', 
    315        'creator_id' => '1', 
    316        'del_flg' => '1', 
    317        'update_date' => '2000-01-01 00:00:00' 
    318      ), 
    319      array( 
    320        'deliv_id' => '1001', 
    321        'product_type_id' => '1001', 
    322        'name' => '配送業者01', 
    323        'creator_id' => '1', 
    324        'rank' => '2', 
    325        'update_date' => '2000-01-01 00:00:00' 
    326      ), 
    327      array( 
    328        'deliv_id' => '1002', 
    329        'product_type_id' => '1001', 
    330        'name' => '配送業者02', 
    331        'creator_id' => '1', 
    332        'rank' => '3', 
    333        'update_date' => '2000-01-01 00:00:00' 
    334      ), 
    335      array( // 商品種別違い 
    336        'deliv_id' => '1004', 
    337        'product_type_id' => '2001', 
    338        'name' => '配送業者21', 
    339        'creator_id' => '1', 
    340        'rank' => '4', 
    341        'update_date' => '2000-01-01 00:00:00' 
    342      ), 
    343    ); 
    344  
    345    $this->objQuery->delete('dtb_deliv'); 
    346    foreach ($deliv as $key => $item) { 
    347      $this->objQuery->insert('dtb_deliv', $item); 
    348    } 
    349  } 
    350  
    351  /** 
    352   * DBにお届け時間の情報を登録します. 
    353   */ 
    354  protected function setUpDelivTime() 
    355  { 
    356    $deliv_time = array( 
    357      array( 
    358        'deliv_id' => '1002', 
    359        'time_id' => '1', 
    360        'deliv_time' => '午前' 
    361      ), 
    362      array( 
    363        'deliv_id' => '1001', 
    364        'time_id' => '2', 
    365        'deliv_time' => '午後' 
    366      ), 
    367      array( 
    368        'deliv_id' => '1001', 
    369        'time_id' => '1', 
    370        'deliv_time' => '午前' 
    371      ), 
    372    ); 
    373  
    374    $this->objQuery->delete('dtb_delivtime'); 
    375    foreach ($deliv_time as $key => $item) { 
    376      $this->objQuery->insert('dtb_delivtime', $item); 
    377    } 
    378  } 
    379  
    380  /** 
    381   * DBに支払方法の情報を登録します. 
    382   */ 
    383  protected function setUpPayment() 
    384  { 
    385    $payment = array( 
    386      array( 
    387        'update_date' => '2000-01-01 00:00:00', 
    388        'payment_id' => '1001', 
    389        'creator_id' => '1', 
    390        'payment_method' => '支払方法1001' 
    391      ), 
    392      array( 
    393        'update_date' => '2000-01-01 00:00:00', 
    394        'payment_id' => '1002', 
    395        'creator_id' => '1', 
    396        'payment_method' => '支払方法1002', 
    397        'del_flg' => '1' 
    398      ), 
    399      array( 
    400        'update_date' => '2000-01-01 00:00:00', 
    401        'payment_id' => '1003', 
    402        'creator_id' => '1', 
    403        'payment_method' => '支払方法1003' 
    404      ), 
    405      array( 
    406        'update_date' => '2000-01-01 00:00:00', 
    407        'payment_id' => '3001', 
    408        'creator_id' => '1', 
    409        'payment_method' => '支払方法3001', 
    410        'del_flg' => '1' 
    411      ), 
    412      array( 
    413        'update_date' => '2000-01-01 00:00:00', 
    414        'payment_id' => '3002', 
    415        'creator_id' => '1', 
    416        'payment_method' => '支払方法3002' 
    417      ), 
    418      array( 
    419        'update_date' => '2000-01-01 00:00:00', 
    420        'payment_id' => '3003', 
    421        'creator_id' => '1', 
    422        'payment_method' => '支払方法3003', 
    423        'rule_max' => 10000 
    424      ), 
    425      array( 
    426        'update_date' => '2000-01-01 00:00:00', 
    427        'payment_id' => '3004', 
    428        'creator_id' => '1', 
    429        'payment_method' => '支払方法3004', 
    430        'upper_rule' => 20000 
    431      ), 
    432      array( 
    433        'update_date' => '2000-01-01 00:00:00', 
    434        'payment_id' => '3005', 
    435        'creator_id' => '1', 
    436        'payment_method' => '支払方法3005', 
    437        'rule_max' => 12000, 
    438        'upper_rule' => 21000 
    439      ) 
    440    ); 
    441  
    442    $this->objQuery->delete('dtb_payment'); 
    443    foreach ($payment as $key => $item) { 
    444      $this->objQuery->insert('dtb_payment', $item); 
    445    } 
    446  } 
    447  
    448  /** 
    449   * DBに受注情報を設定します. 
    450   */ 
    451   protected function setUpOrder() 
    452   { 
    453     $order = array( 
    454       array( 
    455         'update_date' => '2000-01-01 00:00:00', 
    456         'order_id' => '1001', 
    457         'customer_id' => '1001', 
    458         'order_name01' => '受注情報01', 
    459         'status' => '3', 
    460         'payment_date' => '2032-12-31 01:20:30', // 日付が変わっても良いように、遠い未来に設定 
    461         'use_point' => '10', 
    462         'add_point' => '20' 
    463       ), 
    464       array( 
    465         'update_date' => '2000-01-01 00:00:00', 
    466         'order_id' => '1002', 
    467         'customer_id' => '1002', 
    468         'order_name01' => '受注情報02', 
    469         'status' => '5', 
    470         'payment_id' => '1002', 
    471         'payment_method' => '支払方法1001', 
    472         'deliv_id' => '1002', 
    473         'use_point' => '10', 
    474         'add_point' => '20' 
    475       ) 
    476     ); 
    477  
    478     $this->objQuery->delete('dtb_order'); 
    479     foreach ($order as $item) { 
    480       $this->objQuery->insert('dtb_order', $item); 
    481     } 
    482   } 
    483  
    484  /** 
    485   * DBに受注一時情報を設定します. 
    486   */ 
    487   protected function setUpOrderTemp() 
    488   { 
    489     $order = array( 
    490       array( 
    491         'update_date' => '2000-01-01 00:00:00', 
    492         'order_temp_id' => '1001', 
    493         'customer_id' => '1001', 
    494         'order_name01' => '受注情報01', 
    495         'order_id' => '1001' 
    496       ), 
    497       array( 
    498         'update_date' => '2000-01-01 00:00:00', 
    499         'order_temp_id' => '1002', 
    500         'customer_id' => '1002', 
    501         'order_name01' => '受注情報02', 
    502         'payment_id' => '1002', 
    503         'payment_method' => '支払方法1001' 
    504       ) 
    505     ); 
    506  
    507     $this->objQuery->delete('dtb_order_temp'); 
    508     foreach ($order as $item) { 
    509       $this->objQuery->insert('dtb_order_temp', $item); 
    510     } 
    511   } 
    512  
    513  /** 
    514   * DBに受注詳細を設定します. 
    515   */ 
    516  protected function setUpOrderDetail() 
    517  { 
    518    $order_detail = array( 
    519      array( 
    520        'order_detail_id' => '1001', 
    521        'order_id' => '1001', 
    522        'product_id' => '1002', 
    523        'product_class_id' => '1002', 
    524        'product_code' => 'pc1002', 
    525        'product_name' => '製品名1002', 
    526        'classcategory_name1' => 'cat10021', 
    527        'classcategory_name2' => 'cat10022', 
    528        'price' => 3000, 
    529        'quantity' => 10, 
    530        'point_rate' => 5, 
    531        'tax_rate' => 5, 
    532        'tax_rule' => 0 
    533      ), 
    534      array( 
    535        'order_detail_id' => '1002', 
    536        'order_id' => '1001', 
    537        'product_id' => '1001', 
    538        'product_class_id' => '1001', 
    539        'product_code' => 'pc1001', 
    540        'product_name' => '製品名1001', 
    541        'classcategory_name1' => 'cat10011', 
    542        'classcategory_name2' => 'cat10012', 
    543        'price' => 4000, 
    544        'quantity' => 15, 
    545        'point_rate' => 6, 
    546        'tax_rate' => 3, 
    547        'tax_rule' => 1 
    548      ), 
    549      array( 
    550        'order_detail_id' => '1003', 
    551        'order_id' => '1002', 
    552        'product_id' => '1001', 
    553        'product_class_id' => '1001', 
    554        'product_name' => '製品名1003' 
    555      ) 
    556    ); 
    557  
    558    $this->objQuery->delete('dtb_order_detail'); 
    559    foreach ($order_detail as $item) { 
    560      $this->objQuery->insert('dtb_order_detail', $item); 
    561    } 
    562  } 
    563  
    564  /** 
    565   * DBに顧客情報を設定します。 
    566   */ 
    567  protected function setUpCustomer() 
    568  { 
    569    $customer = array( 
    570      array( 
    571        'customer_id' => '1001', 
    572        'name01' => '苗字', 
    573        'name02' => '名前', 
    574        'kana01' => 'みょうじ', 
    575        'kana02' => 'なまえ', 
    576        'email' => 'test@example.com', 
    577        'secret_key' => 'hoge', 
    578        'point' => '100', 
    579        'update_date' => '2000-01-01 00:00:00' 
    580      ), 
    581      array( 
    582        'customer_id' => '1002', 
    583        'name01' => '苗字2', 
    584        'name02' => '名前2', 
    585        'kana01' => 'みょうじ2', 
    586        'kana02' => 'なまえ2', 
    587        'email' => 'test2@example.com', 
    588        'secret_key' => 'hoge2', 
    589        'point' => '200', 
    590        'update_date' => '2000-01-01 00:00:00' 
    591      ) 
    592    ); 
    593  
    594    $this->objQuery->delete('dtb_customer'); 
    595    foreach ($customer as $item) { 
    596      $this->objQuery->insert('dtb_customer', $item); 
    597    } 
    598  } 
    599  
    600101} 
    601102 
  • branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_BestProducts/SC_Helper_BestProducts_getBestProductsTest.php

    r22567 r22656  
    22 
    33$HOME = realpath(dirname(__FILE__)) . "/../../../.."; 
    4 require_once($HOME . "/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php"); 
     4require_once($HOME . "/tests/class/helper/SC_Helper_BestProducts/SC_Helper_BestProducts_TestBase.php"); 
    55/* 
    66 * This file is part of EC-CUBE 
     
    2626 
    2727/** 
    28  * SC_Helper_Purchase::getOrder()のテストクラス. 
     28 * SC_Helper_BestProducts::getBestProducts()のテストクラス. 
    2929 * 
    30  * 
    31  * @author Hiroko Tamagawa 
    32  * @version $Id$ 
     30 * @author hiroshi kakuta 
    3331 */ 
    34 class SC_Helper_Purchase_getOrderTest extends SC_Helper_Purchase_TestBase 
     32class SC_Helper_BestProducts_getBestProductsTest extends SC_Helper_BestProducts_TestBase 
    3533{ 
     34    protected function setUp() 
     35    { 
     36        parent::setUp(); 
     37        $this->setUpBestProducts(); 
     38    } 
     39 
     40    protected function tearDown() 
     41    { 
     42        parent::tearDown(); 
     43    } 
     44 
     45    /** best_idが存在しない場合、空を返す。 
     46     */ 
     47    public function testGetBestProducts_おすすめidが存在しない場合、空を返す() 
     48    { 
     49        $best_id = '9999'; 
     50 
     51        $this->expected = null; 
     52        $this->actual = SC_Helper_BestProducts::getBestProducts($best_id); 
     53 
     54        $this->verify(); 
     55    } 
     56 
     57    // best_idが存在する場合、対応した結果を取得できる。 
     58    public function testGetBestProducts_おすすめIDが存在する場合、対応した結果を取得できる(){ 
     59 
     60        $best_id = '1001'; 
    3661 
    3762 
    38   protected function setUp() 
    39   { 
    40     parent::setUp(); 
    41     $this->setUpOrder(); 
    42   } 
     63        $this->expected = array( 
     64            'category_id' => '0', 
     65            'rank' => '1', 
     66            'title' => 'タイトルですよ', 
     67            'comment' => 'コメントですよ', 
     68            'del_flg' => '0' 
     69        ); 
    4370 
    44   protected function tearDown() 
    45   { 
    46     parent::tearDown(); 
    47   } 
     71        $result = SC_Helper_BestProducts::getBestProducts($best_id); 
     72        $this->actual = Test_Utils::mapArray($result, 
     73            array('category_id', 
     74                'rank', 
     75                'title', 
     76                'comment', 
     77                'del_flg' 
     78            )); 
    4879 
    49   ///////////////////////////////////////// 
    50   public function testGetOrder_存在しない受注IDを指定した場合_結果が空になる() 
    51   { 
    52     $order_id = '9999'; 
     80        $this->verify(); 
    5381 
    54     $this->expected = null; 
    55     $this->actual = SC_Helper_Purchase::getOrder($order_id); 
     82    } 
    5683 
    57     $this->verify(); 
    58   } 
    5984 
    60   public function testGetOrder_存在しない顧客IDを指定した場合_結果が空になる() 
    61   { 
    62     $order_id = '1002'; 
    63     $customer_id = '9999'; 
     85    // best_idが存在するが、del_flg=1の場合、空が帰る。 
     86    public function testGetBestProducts_おすすめIDがあり、かつ削除済みの場合、空が返る(){ 
    6487 
    65     $this->expected = null; 
    66     $this->actual  = SC_Helper_Purchase::getOrder($order_id, $customer_id); 
     88        $best_id = '1002'; 
    6789 
    68     $this->verify(); 
    69   } 
     90        $this->expected = null; 
     91        $this->actual = SC_Helper_BestProducts::getBestProducts($best_id); 
    7092 
    71   public function testGetOrder_顧客IDを指定しなかった場合_受注IDに対応する結果が取得できる() 
    72   { 
    73     $order_id = '1002'; 
     93        $this->verify(); 
    7494 
    75     $this->expected = array( 
    76       'order_id' => '1002', 
    77       'customer_id' => '1002', 
    78       'order_name01' => '受注情報02' 
    79     ); 
    80     $result = SC_Helper_Purchase::getOrder($order_id); 
    81     $this->actual = Test_Utils::mapArray($result, array('order_id', 'customer_id', 'order_name01')); 
     95    } 
    8296 
    83     $this->verify(); 
    84   } 
     97    // best_idが存在するが、del_flg=1の場合、かつ。$has_deleted=trueを指定 
     98    public function testGetBestProducts_削除済みでかつhas_deletedがtrueの場合、対応した結果が返る(){ 
    8599 
    86   public function testGetOrder_存在する顧客IDを指定した場合_対応する結果が取得できる() 
    87   { 
    88     $order_id = '1002'; 
    89     $customer_id = '1002'; 
     100        $best_id = '1002'; 
    90101 
    91     $this->expected = array( 
    92       'order_id' => '1002', 
    93       'customer_id' => '1002', 
    94       'order_name01' => '受注情報02' 
    95     ); 
    96     $result = SC_Helper_Purchase::getOrder($order_id, $customer_id); 
    97     $this->actual = Test_Utils::mapArray($result, array('order_id', 'customer_id', 'order_name01')); 
    98102 
    99     $this->verify(); 
    100   } 
     103        $this->expected = array( 
     104            'category_id' => '0', 
     105            'rank' => '2', 
     106            'title' => 'タイトルですよ', 
     107            'comment' => 'コメントですよ', 
     108            'del_flg' => '1' 
     109        ); 
    101110 
    102   ////////////////////////////////////////// 
     111        $result = SC_Helper_BestProducts::getBestProducts($best_id,true); 
     112        $this->actual = Test_Utils::mapArray($result, 
     113            array('category_id', 
     114                'rank', 
     115                'title', 
     116                'comment', 
     117                'del_flg' 
     118            )); 
    103119 
     120        $this->verify(); 
     121    } 
    104122} 
    105123 
Note: See TracChangeset for help on using the changeset viewer.