[23331] | 1 | <?php |
---|
| 2 | $HOME = realpath(dirname(__FILE__)) . "/../../../.."; |
---|
| 3 | require_once($HOME . "/tests/class/Common_TestCase.php"); |
---|
| 4 | /* |
---|
| 5 | * This file is part of EC-CUBE |
---|
| 6 | * |
---|
| 7 | * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved. |
---|
| 8 | * |
---|
| 9 | * http://www.lockon.co.jp/ |
---|
| 10 | * |
---|
| 11 | * This program is free software; you can redistribute it and/or |
---|
| 12 | * modify it under the terms of the GNU General Public License |
---|
| 13 | * as published by the Free Software Foundation; either version 2 |
---|
| 14 | * of the License, or (at your option) any later version. |
---|
| 15 | * |
---|
| 16 | * This program is distributed in the hope that it will be useful, |
---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 19 | * GNU General Public License for more details. |
---|
| 20 | * |
---|
| 21 | * You should have received a copy of the GNU General Public License |
---|
| 22 | * along with this program; if not, write to the Free Software |
---|
| 23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
| 24 | */ |
---|
| 25 | /** |
---|
| 26 | * SC_Helper_Taxのテストの基底クラス. |
---|
| 27 | * |
---|
| 28 | * @author Nobuhiko Kimoto |
---|
| 29 | * @version $Id$ |
---|
| 30 | */ |
---|
| 31 | class SC_Helper_TaxRule_TestBase extends Common_TestCase |
---|
| 32 | { |
---|
| 33 | |
---|
| 34 | protected function setUp() |
---|
| 35 | { |
---|
| 36 | parent::setUp(); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | protected function tearDown() |
---|
| 40 | { |
---|
| 41 | parent::tearDown(); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | /** |
---|
| 45 | * DBにテストデータを登録する |
---|
| 46 | */ |
---|
| 47 | protected function setUpTax() |
---|
| 48 | { |
---|
[23338] | 49 | $_SESSION['member_id'] = 1; |
---|
[23331] | 50 | $taxs = array( |
---|
| 51 | array( |
---|
| 52 | 'tax_rule_id' => 1000, |
---|
| 53 | 'apply_date' => '2014-01-01 00:00:00', |
---|
| 54 | 'tax_rate' => '5', |
---|
| 55 | 'product_id' => '0', |
---|
| 56 | 'product_class_id' => '0', |
---|
[23332] | 57 | 'del_flg' => '0', |
---|
| 58 | 'member_id' => 1, |
---|
| 59 | 'create_date' => 'CURRENT_TIMESTAMP', |
---|
| 60 | 'update_date' => 'CURRENT_TIMESTAMP', |
---|
[23331] | 61 | ), |
---|
| 62 | array( |
---|
| 63 | 'tax_rule_id' => 1001, |
---|
| 64 | 'apply_date' => '2000-01-01 00:00:00', |
---|
| 65 | 'tax_rate' => '6', |
---|
| 66 | 'product_id' => '0', |
---|
| 67 | 'product_class_id' => '0', |
---|
[23332] | 68 | 'del_flg' => '0', |
---|
| 69 | 'member_id' => 1, |
---|
| 70 | 'create_date' => 'CURRENT_TIMESTAMP', |
---|
| 71 | 'update_date' => 'CURRENT_TIMESTAMP', |
---|
[23331] | 72 | ), |
---|
| 73 | array( |
---|
| 74 | 'tax_rule_id' => 1002, |
---|
| 75 | 'apply_date' => '2099-02-01 00:00:00', |
---|
| 76 | 'tax_rate' => '7', |
---|
| 77 | 'product_id' => '0', |
---|
| 78 | 'product_class_id' => '0', |
---|
[23332] | 79 | 'del_flg' => '0', |
---|
| 80 | 'member_id' => 1, |
---|
| 81 | 'create_date' => 'CURRENT_TIMESTAMP', |
---|
| 82 | 'update_date' => 'CURRENT_TIMESTAMP', |
---|
[23331] | 83 | ), |
---|
| 84 | array( |
---|
| 85 | 'tax_rule_id' => 1003, |
---|
| 86 | 'apply_date' => '2014-02-02 00:00:00', |
---|
| 87 | 'tax_rate' => '8', |
---|
[23333] | 88 | 'product_id' => '1000', |
---|
[23331] | 89 | 'product_class_id' => '0', |
---|
[23332] | 90 | 'del_flg' => '0', |
---|
| 91 | 'member_id' => 1, |
---|
| 92 | 'create_date' => 'CURRENT_TIMESTAMP', |
---|
| 93 | 'update_date' => 'CURRENT_TIMESTAMP', |
---|
[23331] | 94 | ), |
---|
| 95 | array( |
---|
| 96 | 'tax_rule_id' => 1004, |
---|
| 97 | 'apply_date' => '2014-02-03 00:00:00', |
---|
| 98 | 'tax_rate' => '9', |
---|
[23333] | 99 | 'product_id' => '1000', |
---|
| 100 | 'product_class_id' => '2000', |
---|
[23332] | 101 | 'del_flg' => '0', |
---|
| 102 | 'member_id' => 1, |
---|
| 103 | 'create_date' => 'CURRENT_TIMESTAMP', |
---|
| 104 | 'update_date' => 'CURRENT_TIMESTAMP', |
---|
[23331] | 105 | ), |
---|
| 106 | ); |
---|
| 107 | |
---|
| 108 | $this->objQuery->delete('dtb_tax_rule'); |
---|
| 109 | foreach ($taxs as $key => $item) { |
---|
[23338] | 110 | //$this->objQuery->insert('dtb_tax_rule', $item); |
---|
| 111 | $this->objTaxRule->setTaxRule( |
---|
| 112 | 1, |
---|
| 113 | $item['tax_rate'], |
---|
| 114 | $item['apply_date'], |
---|
| 115 | NULL, |
---|
| 116 | 0, |
---|
| 117 | $item['product_id'], |
---|
| 118 | $item['product_class_id'] |
---|
| 119 | ); |
---|
[23331] | 120 | } |
---|
| 121 | } |
---|
| 122 | } |
---|