Changeset 22656 for branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_BestProducts/SC_Helper_BestProducts_getBestProductsTest.php
- Timestamp:
- 2013/03/09 23:43:23 (11 years ago)
- Location:
- branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_BestProducts
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_BestProducts/SC_Helper_BestProducts_getBestProductsTest.php
r22567 r22656 2 2 3 3 $HOME = realpath(dirname(__FILE__)) . "/../../../.."; 4 require_once($HOME . "/tests/class/helper/SC_Helper_ Purchase/SC_Helper_Purchase_TestBase.php");4 require_once($HOME . "/tests/class/helper/SC_Helper_BestProducts/SC_Helper_BestProducts_TestBase.php"); 5 5 /* 6 6 * This file is part of EC-CUBE … … 26 26 27 27 /** 28 * SC_Helper_ Purchase::getOrder()のテストクラス.28 * SC_Helper_BestProducts::getBestProducts()のテストクラス. 29 29 * 30 * 31 * @author Hiroko Tamagawa 32 * @version $Id$ 30 * @author hiroshi kakuta 33 31 */ 34 class SC_Helper_ Purchase_getOrderTest extends SC_Helper_Purchase_TestBase32 class SC_Helper_BestProducts_getBestProductsTest extends SC_Helper_BestProducts_TestBase 35 33 { 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'; 36 61 37 62 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 ); 43 70 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 )); 48 79 49 ///////////////////////////////////////// 50 public function testGetOrder_存在しない受注IDを指定した場合_結果が空になる() 51 { 52 $order_id = '9999'; 80 $this->verify(); 53 81 54 $this->expected = null; 55 $this->actual = SC_Helper_Purchase::getOrder($order_id); 82 } 56 83 57 $this->verify();58 }59 84 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があり、かつ削除済みの場合、空が返る(){ 64 87 65 $this->expected = null; 66 $this->actual = SC_Helper_Purchase::getOrder($order_id, $customer_id); 88 $best_id = '1002'; 67 89 68 $this->verify();69 }90 $this->expected = null; 91 $this->actual = SC_Helper_BestProducts::getBestProducts($best_id); 70 92 71 public function testGetOrder_顧客IDを指定しなかった場合_受注IDに対応する結果が取得できる() 72 { 73 $order_id = '1002'; 93 $this->verify(); 74 94 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 } 82 96 83 $this->verify();84 }97 // best_idが存在するが、del_flg=1の場合、かつ。$has_deleted=trueを指定 98 public function testGetBestProducts_削除済みでかつhas_deletedがtrueの場合、対応した結果が返る(){ 85 99 86 public function testGetOrder_存在する顧客IDを指定した場合_対応する結果が取得できる() 87 { 88 $order_id = '1002'; 89 $customer_id = '1002'; 100 $best_id = '1002'; 90 101 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'));98 102 99 $this->verify(); 100 } 103 $this->expected = array( 104 'category_id' => '0', 105 'rank' => '2', 106 'title' => 'タイトルですよ', 107 'comment' => 'コメントですよ', 108 'del_flg' => '1' 109 ); 101 110 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 )); 103 119 120 $this->verify(); 121 } 104 122 } 105 123
Note: See TracChangeset
for help on using the changeset viewer.