Changeset 22727 for branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Maker/SC_Helper_Maker_saveMakerTest.php
- Timestamp:
- 2013/03/10 12:54:59 (11 years ago)
- Location:
- branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Maker
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Maker/SC_Helper_Maker_saveMakerTest.php
r22695 r22727 2 2 3 3 $HOME = realpath(dirname(__FILE__)) . "/../../../.."; 4 require_once($HOME . "/tests/class/helper/SC_Helper_ BestProducts/SC_Helper_BestProducts_TestBase.php");4 require_once($HOME . "/tests/class/helper/SC_Helper_Maker/SC_Helper_Maker_TestBase.php"); 5 5 /* 6 6 * This file is part of EC-CUBE … … 26 26 27 27 /** 28 * SC_Helper_BestProducts::saveBestProducts()のテストクラス.29 28 * 30 29 * @author hiroshi kakuta 31 30 */ 32 class SC_Helper_ BestProducts_saveBestProductsTest extends SC_Helper_BestProducts_TestBase31 class SC_Helper_Maker_saveMakerTest extends SC_Helper_Maker_TestBase 33 32 { 33 var $objHelperMaker; 34 34 35 protected function setUp() 35 36 { 37 36 38 parent::setUp(); 37 $this->setUpBestProducts(); 39 $this->setUpMaker(); 40 $this->objHelperMaker = new SC_Helper_Maker_Ex(); 38 41 } 39 42 … … 44 47 45 48 46 // best_idを指定して更新される。47 public function testSaveBestProducts_ベストIDがある場合_更新される(){48 49 50 public function testSaveMaker_メーカーIDを指定すると更新される(){ 51 //public function testSaveMaker_update(){ 49 52 $sqlVal = array( 50 'best_id' => '1001', 51 'product_id'=>'3', 52 'category_id' => '1', 53 'rank' => '2', 54 'title' => 'タイトルですよ1001', 55 'comment' => 'コメントですよ1001', 56 'creator_id' => '2', 57 'create_date' => '2000-01-01 00:00:00', 58 'update_date' => '2000-01-01 00:00:00', 59 'del_flg' => '0' 53 'maker_id' => '1001', 54 'name' => 'ソニンー', 60 55 ); 61 56 62 $ result = SC_Helper_BestProducts::saveBestProducts($sqlVal);57 $this->objHelperMaker->saveMaker($sqlVal); 63 58 64 59 $this->expected = array( 65 'product_id'=>'3', 66 'category_id' => '1', 67 'rank' => '2', 68 'title' => 'タイトルですよ1001', 69 'comment' => 'コメントですよ1001', 70 'creator_id' => '1', //変わらない 71 'create_date' => '2000-01-01 00:00:00', 72 'del_flg' => '0' 60 'name' => 'ソニンー', 73 61 ); 74 62 75 $this->actual = SC_Helper_BestProducts::getBestProducts('1001'); 76 77 $arrRet = SC_Helper_BestProducts::getBestProducts('1001'); 78 63 $arrRet = $this->objHelperMaker->getMaker('1001'); 79 64 80 65 $this->actual = Test_Utils::mapArray($arrRet, 81 array('product_id', 82 'category_id', 83 'rank', 84 'title', 85 'comment', 86 'creator_id', 87 'create_date', 88 'del_flg' 89 ) 66 array('name') 90 67 ); 91 68 … … 94 71 95 72 96 // best_idがnullでデータインサートされる。 97 public function testSaveBestProducts_ベストIDがない場合_インサートされる(){ 73 74 public function testSaveMaker_メーカーIDがない場合_インサートされる(){ 75 //public function testSaveMaker_insert(){ 98 76 99 77 if(DB_TYPE != 'pgsql') { //postgresqlだとどうしてもDBエラーになるのでとりいそぎ回避 100 78 $sqlVal = array( 101 'product_id'=>'4', 102 'category_id' => '2', 103 'rank' => '4', 104 'title' => 'タイトルですよ1004', 105 'comment' => 'コメントですよ1004', 106 'creator_id' => '3', 79 'name' => 'フジスリー', 80 'creator_id' => '1', 107 81 'del_flg' => '0' 108 82 ); 109 83 110 $best_id = SC_Helper_BestProducts::saveBestProducts($sqlVal); 84 $maker_id = $this->objHelperMaker->saveMaker($sqlVal); 85 111 86 112 87 $this->expected = array( 113 'product_id'=>'4', 114 'category_id' => '2', 115 'rank' => '4', 116 'title' => 'タイトルですよ1004', 117 'comment' => 'コメントですよ1004', 118 'creator_id' => '3', 88 'name' => 'フジスリー', 89 'rank' => '5', 90 'creator_id' => '1', 119 91 'del_flg' => '0' 120 92 ); 121 93 122 $arrRet = SC_Helper_BestProducts::getBestProducts($best_id); 123 94 $arrRet = $this->objHelperMaker->getMaker($maker_id); 124 95 125 96 $this->actual = Test_Utils::mapArray($arrRet, 126 array( 'product_id',127 ' category_id',97 array( 98 'name', 128 99 'rank', 129 'title',130 'comment',131 100 'creator_id', 132 101 'del_flg' … … 137 106 } 138 107 139 140 }141 142 143 // best_idがnull、かつrankがnullの場合、想定されたランクが登録される144 public function testSaveBestProducts_インサート処理でrankがsetされてない場合_採番された値がセットされる(){145 146 if(DB_TYPE != 'pgsql') { //postgresqlだとどうしてもDBエラーになるのでとりいそぎ回避147 $sqlVal = array(148 'product_id'=>'5',149 'category_id' => '2',150 'title' => 'タイトルですよ5',151 'comment' => 'コメントですよ5',152 'creator_id' => '3',153 'del_flg' => '0'154 );155 156 $best_id = SC_Helper_BestProducts::saveBestProducts($sqlVal);157 158 $this->expected = "4"; //ランク159 160 $arrRet = SC_Helper_BestProducts::getBestProducts($best_id);161 162 163 $this->actual = $arrRet['rank'];164 165 $this->verify();166 }167 108 } 168 109
Note: See TracChangeset
for help on using the changeset viewer.