source: branches/version-2_13-dev/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRuleTest.php @ 23333

Revision 23333, 3.1 KB checked in by kimoto, 10 years ago (diff)

#2503 商品別税率設定の不具合を確認する為のテストを追加

Line 
1<?php
2
3$HOME = realpath(dirname(__FILE__)) . "/../../../..";
4// 商品別税率機能無効
5define('OPTION_PRODUCT_TAX_RULE', 0);
6require_once($HOME . "/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_TestBase.php");
7
8class SC_Helper_TaxRule_getTaxRuleTest extends SC_Helper_TaxRule_TestBase
9{
10
11    protected function setUp()
12    {
13        parent::setUp();
14        $this->objTaxRule = new SC_Helper_TaxRule_Ex();
15    }
16
17    protected function tearDown()
18    {
19        parent::tearDown();
20    }
21
22    /////////////////////////////////////////
23
24    /**
25     * @test
26     */
27    public function 定数が正しく設定されているかのテスト()
28    {
29        $this->expected = 0;
30        $this->actual = constant('OPTION_PRODUCT_TAX_RULE');
31        $this->verify();
32    }
33
34    /**
35     * @test
36     */
37    public function 引数がからの場合税率設定で設定かつ適用日時内の最新の値が返される()
38    {
39        $this->setUpTax();
40        $this->expected = array(
41            'apply_date' => '2014-01-01 00:00:00',
42            'tax_rate' => '5',
43            'product_id' => '0',
44            'product_class_id' => '0',
45            'del_flg' => '0'
46        );
47
48        $return = $this->objTaxRule->getTaxRule();
49        $this->actual = array(
50            'apply_date' => $return['apply_date'],
51            'tax_rate' => $return['tax_rate'],
52            'product_id' => $return['product_id'],
53            'product_class_id' => $return['product_class_id'],
54            'del_flg' => $return['del_flg']
55        );
56
57        $this->verify();
58    }
59
60    /**
61     * @test
62     */
63    public function 商品idを指定した場合税率設定で設定かつ適用日時内の最新の値が返される()
64    {
65        $this->setUpTax();
66        $this->expected = array(
67            'apply_date' => '2014-01-01 00:00:00',
68            'tax_rate' => '5',
69            'product_id' => '0',
70            'product_class_id' => '0',
71            'del_flg' => '0'
72        );
73
74        $return = $this->objTaxRule->getTaxRule(1000);
75        $this->actual = array(
76            'apply_date' => $return['apply_date'],
77            'tax_rate' => $return['tax_rate'],
78            'product_id' => $return['product_id'],
79            'product_class_id' => $return['product_class_id'],
80            'del_flg' => $return['del_flg']
81        );
82
83        $this->verify();
84    }
85
86    /**
87     * @test
88     */
89    public function 商品規格idを指定した場合税率設定で設定かつ適用日時内の最新の値が返される()
90    {
91        $this->setUpTax();
92        $this->expected = array(
93            'apply_date' => '2014-02-03 00:00:00',
94            'tax_rate' => '5',
95            'product_id' => '0',
96            'product_class_id' => '0',
97            'del_flg' => '0'
98        );
99
100        $return = $this->objTaxRule->getTaxRule(1000, 2000);
101        $this->actual = array(
102            'apply_date' => $return['apply_date'],
103            'tax_rate' => $return['tax_rate'],
104            'product_id' => $return['product_id'],
105            'product_class_id' => $return['product_class_id'],
106            'del_flg' => $return['del_flg']
107        );
108
109        $this->verify();
110    }
111}
Note: See TracBrowser for help on using the repository browser.