| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | $HOME = realpath(dirname(__FILE__)) . "/../../../.."; |
|---|
| 4 | require_once($HOME . "/tests/class/Common_TestCase.php"); |
|---|
| 5 | /* |
|---|
| 6 | * This file is part of EC-CUBE |
|---|
| 7 | * |
|---|
| 8 | * Copyright(c) 2000-2014 LOCKON CO.,LTD. All Rights Reserved. |
|---|
| 9 | * |
|---|
| 10 | * http://www.lockon.co.jp/ |
|---|
| 11 | * |
|---|
| 12 | * This program is free software; you can redistribute it and/or |
|---|
| 13 | * modify it under the terms of the GNU General Public License |
|---|
| 14 | * as published by the Free Software Foundation; either version 2 |
|---|
| 15 | * of the License, or (at your option) any later version. |
|---|
| 16 | * |
|---|
| 17 | * This program is distributed in the hope that it will be useful, |
|---|
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 20 | * GNU General Public License for more details. |
|---|
| 21 | * |
|---|
| 22 | * You should have received a copy of the GNU General Public License |
|---|
| 23 | * along with this program; if not, write to the Free Software |
|---|
| 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 25 | */ |
|---|
| 26 | |
|---|
| 27 | /** |
|---|
| 28 | * SC_Utils::sfGetClassCatCount()のテストクラス. |
|---|
| 29 | * |
|---|
| 30 | * |
|---|
| 31 | * @author Hiroko Tamagawa |
|---|
| 32 | * @version $Id$ |
|---|
| 33 | */ |
|---|
| 34 | class SC_Utils_sfGetClassCatCountTest extends Common_TestCase |
|---|
| 35 | { |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | protected function setUp() |
|---|
| 39 | { |
|---|
| 40 | parent::setUp(); |
|---|
| 41 | $this->setUpClassCat(); |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | protected function tearDown() |
|---|
| 45 | { |
|---|
| 46 | parent::tearDown(); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | ///////////////////////////////////////// |
|---|
| 50 | public function testSfGetClassCatCount__規格分類の件数がIDごとに取得できる() |
|---|
| 51 | { |
|---|
| 52 | |
|---|
| 53 | $this->expected = array( |
|---|
| 54 | '1001' => '2', |
|---|
| 55 | '1002' => '1' |
|---|
| 56 | ); |
|---|
| 57 | $this->actual = SC_Utils::sfGetClassCatCount(); |
|---|
| 58 | |
|---|
| 59 | $this->verify('規格分類の件数'); |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | ////////////////////////////////////////// |
|---|
| 63 | |
|---|
| 64 | protected function setUpClassCat() |
|---|
| 65 | { |
|---|
| 66 | $classes = array( |
|---|
| 67 | array( |
|---|
| 68 | 'class_id' => '1001', |
|---|
| 69 | 'name' => '味', |
|---|
| 70 | 'creator_id' => '1', |
|---|
| 71 | 'update_date' => 'CURRENT_TIMESTAMP', |
|---|
| 72 | 'del_flg' => '0' |
|---|
| 73 | ), |
|---|
| 74 | array( |
|---|
| 75 | 'class_id' => '1002', |
|---|
| 76 | 'name' => '大きさ', |
|---|
| 77 | 'creator_id' => '1', |
|---|
| 78 | 'update_date' => 'CURRENT_TIMESTAMP', |
|---|
| 79 | 'del_flg' => '0' |
|---|
| 80 | ), |
|---|
| 81 | // 削除フラグが立っているので検索されない |
|---|
| 82 | array( |
|---|
| 83 | 'class_id' => '1003', |
|---|
| 84 | 'name' => '匂い', |
|---|
| 85 | 'creator_id' => '1', |
|---|
| 86 | 'update_date' => 'CURRENT_TIMESTAMP', |
|---|
| 87 | 'del_flg' => '1' |
|---|
| 88 | ) |
|---|
| 89 | ); |
|---|
| 90 | $this->objQuery->delete('dtb_class'); |
|---|
| 91 | foreach ($classes as $item) { |
|---|
| 92 | $this->objQuery->insert('dtb_class', $item); |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | $class_categories = array( |
|---|
| 96 | array( |
|---|
| 97 | 'classcategory_id' => '1011', |
|---|
| 98 | 'class_id' => '1001', |
|---|
| 99 | 'creator_id' => '1', |
|---|
| 100 | 'update_date' => 'CURRENT_TIMESTAMP' |
|---|
| 101 | ), |
|---|
| 102 | // 削除フラグが立っているので検索されない |
|---|
| 103 | array( |
|---|
| 104 | 'classcategory_id' => '1012', |
|---|
| 105 | 'class_id' => '1001', |
|---|
| 106 | 'creator_id' => '1', |
|---|
| 107 | 'update_date' => 'CURRENT_TIMESTAMP', |
|---|
| 108 | 'del_flg' => '1' |
|---|
| 109 | ), |
|---|
| 110 | array( |
|---|
| 111 | 'classcategory_id' => '1013', |
|---|
| 112 | 'class_id' => '1001', |
|---|
| 113 | 'creator_id' => '1', |
|---|
| 114 | 'update_date' => 'CURRENT_TIMESTAMP' |
|---|
| 115 | ), |
|---|
| 116 | array( |
|---|
| 117 | 'classcategory_id' => '1021', |
|---|
| 118 | 'class_id' => '1002', |
|---|
| 119 | 'creator_id' => '1', |
|---|
| 120 | 'update_date' => 'CURRENT_TIMESTAMP' |
|---|
| 121 | ), |
|---|
| 122 | // dtb_classでdel_flgが立っているので検索されない |
|---|
| 123 | array( |
|---|
| 124 | 'classcategory_id' => '1031', |
|---|
| 125 | 'class_id' => '1003', |
|---|
| 126 | 'creator_id' => '1', |
|---|
| 127 | 'update_date' => 'CURRENT_TIMESTAMP' |
|---|
| 128 | ) |
|---|
| 129 | ); |
|---|
| 130 | // classcategory_id=0のものは削除しない |
|---|
| 131 | $this->objQuery->delete('dtb_classcategory', 'classcategory_id <> 0'); |
|---|
| 132 | foreach ($class_categories as $item) { |
|---|
| 133 | $this->objQuery->insert('dtb_classcategory', $item); |
|---|
| 134 | } |
|---|
| 135 | } |
|---|
| 136 | } |
|---|
| 137 | |
|---|