[23331] | 1 | <?php |
---|
| 2 | |
---|
| 3 | $HOME = realpath(dirname(__FILE__)) . "/../../../.."; |
---|
| 4 | // 商品別税率機能無効 |
---|
| 5 | define('OPTION_PRODUCT_TAX_RULE', 1); |
---|
| 6 | require_once($HOME . "/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_TestBase.php"); |
---|
| 7 | |
---|
| 8 | class SC_Helper_TaxRule_getTaxRule_OptionProductTaxRuleTest extends SC_Helper_TaxRule_TestBase |
---|
| 9 | { |
---|
| 10 | |
---|
| 11 | protected function setUp() |
---|
| 12 | { |
---|
| 13 | parent::setUp(); |
---|
| 14 | $this->objTaxRule = new SC_Helper_TaxRule_Ex(); |
---|
[23339] | 15 | $this->setUpTax(); |
---|
[23331] | 16 | } |
---|
| 17 | |
---|
| 18 | protected function tearDown() |
---|
| 19 | { |
---|
| 20 | parent::tearDown(); |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | ///////////////////////////////////////// |
---|
| 24 | |
---|
| 25 | /** |
---|
| 26 | * @test |
---|
[23343] | 27 | * @runInSeparateProcess |
---|
| 28 | * @preserveGlobalState disabled |
---|
[23331] | 29 | */ |
---|
| 30 | public function 定数が正しく設定されているかのテスト() |
---|
| 31 | { |
---|
| 32 | $this->expected = 1; |
---|
| 33 | $this->actual = constant('OPTION_PRODUCT_TAX_RULE'); |
---|
| 34 | $this->verify(); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | /** |
---|
| 38 | * @test |
---|
[23343] | 39 | * @runInSeparateProcess |
---|
| 40 | * @preserveGlobalState disabled |
---|
[23331] | 41 | */ |
---|
| 42 | public function 引数がからの場合税率設定で設定かつ適用日時内の最新の値が返される() |
---|
| 43 | { |
---|
| 44 | $this->expected = array( |
---|
| 45 | 'apply_date' => '2014-01-01 00:00:00', |
---|
| 46 | 'tax_rate' => '5', |
---|
| 47 | 'product_id' => '0', |
---|
| 48 | 'product_class_id' => '0', |
---|
| 49 | 'del_flg' => '0' |
---|
| 50 | ); |
---|
| 51 | |
---|
| 52 | $return = $this->objTaxRule->getTaxRule(); |
---|
| 53 | $this->actual = array( |
---|
| 54 | 'apply_date' => $return['apply_date'], |
---|
| 55 | 'tax_rate' => $return['tax_rate'], |
---|
| 56 | 'product_id' => $return['product_id'], |
---|
| 57 | 'product_class_id' => $return['product_class_id'], |
---|
| 58 | 'del_flg' => $return['del_flg'] |
---|
| 59 | ); |
---|
| 60 | |
---|
| 61 | $this->verify(); |
---|
[23333] | 62 | } |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * @test |
---|
[23343] | 66 | * @runInSeparateProcess |
---|
| 67 | * @preserveGlobalState disabled |
---|
[23333] | 68 | */ |
---|
| 69 | public function 商品idを指定した場合商品に設定かつ適用日時内の最新の値が返される() |
---|
| 70 | { |
---|
| 71 | $this->expected = array( |
---|
| 72 | 'apply_date' => '2014-02-02 00:00:00', |
---|
| 73 | 'tax_rate' => '8', |
---|
| 74 | 'product_id' => '1000', |
---|
| 75 | 'product_class_id' => '0', |
---|
| 76 | 'del_flg' => '0' |
---|
| 77 | ); |
---|
| 78 | |
---|
| 79 | $return = $this->objTaxRule->getTaxRule(1000); |
---|
| 80 | $this->actual = array( |
---|
| 81 | 'apply_date' => $return['apply_date'], |
---|
| 82 | 'tax_rate' => $return['tax_rate'], |
---|
| 83 | 'product_id' => $return['product_id'], |
---|
| 84 | 'product_class_id' => $return['product_class_id'], |
---|
| 85 | 'del_flg' => $return['del_flg'] |
---|
| 86 | ); |
---|
| 87 | |
---|
| 88 | $this->verify(); |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | /** |
---|
| 92 | * @test |
---|
[23343] | 93 | * @runInSeparateProcess |
---|
| 94 | * @preserveGlobalState disabled |
---|
[23333] | 95 | */ |
---|
| 96 | public function 商品規格idを指定した場合商品に登録かつ適用日時内の最新の値が返される() |
---|
| 97 | { |
---|
| 98 | $this->expected = array( |
---|
| 99 | 'apply_date' => '2014-02-03 00:00:00', |
---|
| 100 | 'tax_rate' => '9', |
---|
| 101 | 'product_id' => '1000', |
---|
| 102 | 'product_class_id' => '2000', |
---|
| 103 | 'del_flg' => '0' |
---|
| 104 | ); |
---|
| 105 | |
---|
| 106 | $return = $this->objTaxRule->getTaxRule(1000, 2000); |
---|
| 107 | $this->actual = array( |
---|
| 108 | 'apply_date' => $return['apply_date'], |
---|
| 109 | 'tax_rate' => $return['tax_rate'], |
---|
| 110 | 'product_id' => $return['product_id'], |
---|
| 111 | 'product_class_id' => $return['product_class_id'], |
---|
| 112 | 'del_flg' => $return['del_flg'] |
---|
| 113 | ); |
---|
| 114 | |
---|
| 115 | $this->verify(); |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | /** |
---|
| 119 | * @test |
---|
[23343] | 120 | * @runInSeparateProcess |
---|
| 121 | * @preserveGlobalState disabled |
---|
[23333] | 122 | */ |
---|
| 123 | public function 商品規格idのみを指定した場合税率設定に登録かつ適用日時内の最新の値が返される() |
---|
| 124 | { |
---|
| 125 | $this->expected = array( |
---|
| 126 | 'apply_date' => '2014-01-01 00:00:00', |
---|
| 127 | 'tax_rate' => '5', |
---|
| 128 | 'product_id' => '0', |
---|
| 129 | 'product_class_id' => '0', |
---|
| 130 | 'del_flg' => '0' |
---|
| 131 | ); |
---|
| 132 | |
---|
| 133 | $return = $this->objTaxRule->getTaxRule(0, 2000); |
---|
| 134 | $this->actual = array( |
---|
| 135 | 'apply_date' => $return['apply_date'], |
---|
| 136 | 'tax_rate' => $return['tax_rate'], |
---|
| 137 | 'product_id' => $return['product_id'], |
---|
| 138 | 'product_class_id' => $return['product_class_id'], |
---|
| 139 | 'del_flg' => $return['del_flg'] |
---|
| 140 | ); |
---|
| 141 | |
---|
| 142 | $this->verify(); |
---|
| 143 | } |
---|
[23331] | 144 | } |
---|