Ignore:
Timestamp:
2012/12/16 11:18:18 (11 years ago)
Author:
shift_hiroko.tamagawa
Message:

一部単体テストを追加(SC_Utils.php/SC_Helper_Purchase.php)

Location:
branches/version-2_12-dev/tests/class
Files:
18 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/tests/class/Common_TestCase.php

    r22128 r22139  
    44require_once($HOME . "/tests/class/replace/SC_Display_Ex.php"); 
    55require_once($HOME . "/tests/class/replace/SC_Response_Ex.php"); 
     6require_once($HOME . "/tests/class/test/util/Test_Utils.php"); 
    67require_once($HOME . "/tests/class/test/util/User_Utils.php"); 
    78require_once($HOME . "/tests/require.php"); 
  • branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php

    r22135 r22139  
    5858   */ 
    5959  protected function setUpShippingOnDb() { 
    60     $data = array( 
    61       array( 
    62         'shipping_id' => '00001', 
    63         'order_id' => '00001', 
     60    $shippings = array( 
     61      array( 
     62        'shipping_id' => '1', 
     63        'order_id' => '1', 
    6464        'shipping_name01' => '配送情報01', 
    6565        'shipping_date' => '2012-01-12' 
    6666      ), 
    6767      array( 
    68         'shipping_id' => '00002', 
    69         'order_id' => '00002', 
     68        'shipping_id' => '2', 
     69        'order_id' => '2', 
    7070        'shipping_name01' => '配送情報02', 
    7171        'shipping_date' => '2011-10-01' 
    7272      ) 
    7373    ); 
    74     $this->objQuery->insert('dtb_shipping', $data[0]); 
    75     $this->objQuery->insert('dtb_shipping', $data[1]); 
    76   } 
     74 
     75    foreach ($shippings as $key => $item) { 
     76      $this->objQuery->insert('dtb_shipping', $item); 
     77    } 
     78  } 
     79 
     80  /** 
     81   * DBに配送商品情報を設定します。 
     82   */ 
     83  protected function setUpShipmentItem() { 
     84      $shipping_items = array( 
     85        array( 
     86          'shipping_id' => '1', 
     87          'product_class_id' => '1001', 
     88          'order_id' => '1', 
     89          'product_name' => '商品名01', 
     90          'price' => '1500' 
     91        ), 
     92        array( 
     93          'shipping_id' => '1', 
     94          'product_class_id' => '1002', 
     95          'order_id' => '1', 
     96          'product_name' => '商品名02', 
     97          'price' => '2400' 
     98        ) 
     99      ); 
     100 
     101    foreach ($shipping_items as $key => $item) { 
     102      $this->objQuery->insert('dtb_shipment_item', $item); 
     103    } 
     104    $this->setUpProductClass(); 
     105  } 
     106 
     107  /** 
     108   * DBに商品クラス情報を設定します. 
     109   */ 
     110  protected function setUpProductClass() { 
     111      $product_class = array( 
     112        array( 
     113          'product_class_id' => '1001', 
     114          'product_id' => '1001', 
     115          'product_code' => 'code1001', 
     116          'classcategory_id1' => '1001', 
     117          'classcategory_id2' => '1002', 
     118          'price01' => '1500', 
     119          'price02' => '1500', 
     120          'del_flg' => '0' 
     121        ), 
     122        array( 
     123          'product_class_id' => '1002', 
     124          'product_id' => '1002', 
     125          'del_flg' => '0' 
     126        ) 
     127      ); 
     128 
     129    foreach ($product_class as $key => $item) { 
     130      $this->objQuery->insert('dtb_products_class', $item); 
     131    } 
     132    $this->setUpClassCategory(); 
     133    $this->setUpProducts(); 
     134  } 
     135 
     136  /** 
     137   * DBに製品カテゴリ情報を登録します. 
     138   */ 
     139  protected function setUpClassCategory() { 
     140    $class_category = array( 
     141      array( 
     142        'classcategory_id' => '1001', 
     143        'name' => 'cat1001' 
     144      ), 
     145      array( 
     146        'classcategory_id' => '1002', 
     147        'name' => 'cat1002' 
     148      ) 
     149    ); 
     150 
     151    foreach ($class_category as $key => $item) { 
     152      $this->objQuery->insert('dtb_classcategory', $item); 
     153    } 
     154  } 
     155 
     156  /**  
     157   * DBに製品情報を登録します. 
     158   */ 
     159 protected function setUpProducts() { 
     160   $products = array( 
     161     array( 
     162       'product_id' => '1001', 
     163       'name' => '製品名1001' 
     164     ), 
     165     array( 
     166       'product_id' => '1002', 
     167       'name' => '製品名1002' 
     168     ) 
     169   ); 
     170 
     171   foreach ($products as $key => $item) { 
     172     $this->objQuery->insert('dtb_products', $item); 
     173   } 
     174 } 
     175 
     176 /** 
     177  * DBに支払方法の情報を登録します. 
     178  */ 
     179 protected function setUpPaymentOptions() { 
     180   $payment_options = array( 
     181     array( 
     182       'deliv_id' => '2001', 
     183       'payment_id' => '2001', 
     184       'rank' => '1' 
     185     ), 
     186     array( 
     187       'deliv_id' => '1001', 
     188       'payment_id' => '1001', 
     189       'rank' => '2' 
     190     ), 
     191     array( 
     192       'deliv_id' => '1001', 
     193       'payment_id' => '1002', 
     194       'rank' => '1' 
     195     ) 
     196   ); 
     197 
     198   foreach ($payment_options as $key => $item) { 
     199     $this->objQuery->insert('dtb_payment_options', $item); 
     200   } 
     201 } 
     202  
     203 /** 
     204  * DBに配送業者の情報を登録します. 
     205  */ 
     206 protected function setUpDeliv() { 
     207   $deliv = array( 
     208     array(  // 削除フラグON 
     209       'deliv_id' => '2001', 
     210       'product_type_id' => '1001', 
     211       'name' => '配送業者del', 
     212       'rank' => '1', 
     213       'del_flg' => '1' 
     214     ), 
     215     array( 
     216       'deliv_id' => '1001', 
     217       'product_type_id' => '1001', 
     218       'name' => '配送業者01', 
     219       'rank' => '2' 
     220     ), 
     221     array( 
     222       'deliv_id' => '1002', 
     223       'product_type_id' => '1001', 
     224       'name' => '配送業者02', 
     225       'rank' => '3' 
     226     ), 
     227     array( // 商品種別違い 
     228       'deliv_id' => '1004', 
     229       'product_type_id' => '2001', 
     230       'name' => '配送業者21', 
     231       'rank' => '4' 
     232     ), 
     233   ); 
     234 
     235   foreach ($deliv as $key => $item) { 
     236     $this->objQuery->insert('dtb_deliv', $item); 
     237   } 
     238 } 
     239 
     240 /** 
     241  * DBにお届け時間の情報を登録します. 
     242  */ 
     243 protected function setUpDelivTime() { 
     244   $deliv_time = array( 
     245     array( 
     246       'deliv_id' => '1002', 
     247       'time_id' => '1', 
     248       'deliv_time' => '午前' 
     249     ), 
     250     array( 
     251       'deliv_id' => '1001', 
     252       'time_id' => '2', 
     253       'deliv_time' => '午後' 
     254     ), 
     255     array( 
     256       'deliv_id' => '1001', 
     257       'time_id' => '1', 
     258       'deliv_time' => '午前' 
     259     ), 
     260   ); 
     261 
     262   foreach ($deliv_time as $key => $item) { 
     263     $this->objQuery->insert('dtb_delivtime', $item); 
     264   } 
     265 } 
     266 
     267 /** 
     268  * DBに支払方法の情報を登録します. 
     269  */ 
     270 protected function setUpPayment() { 
     271   $payment = array( 
     272     array( 
     273       'payment_id' => '1001', 
     274       'payment_method' => '支払方法1001' 
     275     ), 
     276     array( 
     277       'payment_id' => '1002', 
     278       'payment_method' => '支払方法1002', 
     279       'del_flg' => '1' 
     280     ), 
     281     array( 
     282       'payment_id' => '1003', 
     283       'payment_method' => '支払方法1003' 
     284     ) 
     285   ); 
     286 
     287   foreach ($payment as $key => $item) { 
     288     $this->objQuery->insert('dtb_payment', $item); 
     289   } 
     290 } 
    77291} 
    78292 
  • branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingPrefTest.php

    r22135 r22139  
    22 
    33$HOME = realpath(dirname(__FILE__)) . "/../../../.."; 
    4 require_once($HOME . "/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestiBase.php"); 
     4require_once($HOME . "/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php"); 
    55/** 
    66 * 
  • branches/version-2_12-dev/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php

    r22135 r22139  
    1818 
    1919  ///////////////////////////////////////// 
    20   public function testRegsiterShipping_元々存在しない受注IDの場合_新規にデータが作られる() { 
     20  public function testRegisterShipping_元々存在しない受注IDの場合_新規にデータが作られる() { 
    2121    $order_id = '10'; 
    2222    $arrParams = array( 
Note: See TracChangeset for help on using the changeset viewer.