1 | <?php |
---|
2 | |
---|
3 | $HOME = realpath(dirname(__FILE__)) . "/../../../.."; |
---|
4 | require_once($HOME . "/tests/class/Common_TestCase.php"); |
---|
5 | /** |
---|
6 | * |
---|
7 | */ |
---|
8 | class SC_Utils_sfTaxTest extends Common_TestCase { |
---|
9 | |
---|
10 | protected function setUp() { |
---|
11 | parent::setUp(); |
---|
12 | } |
---|
13 | |
---|
14 | protected function tearDown() { |
---|
15 | parent::tearDown(); |
---|
16 | } |
---|
17 | |
---|
18 | ///////////////////////////////////////// |
---|
19 | public function testSfTax_四捨五入の場合_四捨五入の結果になる() { |
---|
20 | $this->expected = array(1, 2); |
---|
21 | $this->actual[0] = SC_Utils::sfTax(140, 1, 1); // 1:四捨五入 |
---|
22 | $this->actual[1] = SC_Utils::sfTax(150, 1, 1); // 1:四捨五入 |
---|
23 | |
---|
24 | $this->verify('税額'); |
---|
25 | } |
---|
26 | |
---|
27 | public function testSfTax_切り捨ての場合_切り捨ての結果になる() { |
---|
28 | $this->expected = array(2, 3); |
---|
29 | $this->actual[0] = SC_Utils::sfTax(140, 2, 2); // 2:切り捨て |
---|
30 | $this->actual[1] = SC_Utils::sfTax(150, 2, 2); // 2:切り捨て |
---|
31 | |
---|
32 | $this->verify('税額'); |
---|
33 | } |
---|
34 | |
---|
35 | public function testSfTax_切り上げの場合_切り上げの結果になる() { |
---|
36 | $this->expected = array(2, 2); |
---|
37 | $this->actual[0] = SC_Utils::sfTax(140, 1, 3); // 3:切り上げ |
---|
38 | $this->actual[1] = SC_Utils::sfTax(150, 1, 3); // 3:切り上げ |
---|
39 | |
---|
40 | $this->verify('税額'); |
---|
41 | } |
---|
42 | |
---|
43 | public function testSfTax_それ以外の場合_切り上げの結果になる() { |
---|
44 | $this->expected = array(2, 2); |
---|
45 | $this->actual[0] = SC_Utils::sfTax(140, 1, 4); |
---|
46 | $this->actual[1] = SC_Utils::sfTax(150, 1, 4); |
---|
47 | |
---|
48 | $this->verify('税額'); |
---|
49 | } |
---|
50 | |
---|
51 | } |
---|
52 | |
---|