1 | <?php |
---|
2 | |
---|
3 | $HOME = realpath(dirname(__FILE__)) . "/../../.."; |
---|
4 | require_once($HOME . "/tests/class/SC_Product/SC_Product_TestBase.php"); |
---|
5 | /** |
---|
6 | * |
---|
7 | */ |
---|
8 | class SC_Product_reduceStockTest extends SC_Product_TestBase |
---|
9 | { |
---|
10 | |
---|
11 | protected function setUp() |
---|
12 | { |
---|
13 | parent::setUp(); |
---|
14 | $this->objProducts = new SC_Product_Ex(); |
---|
15 | } |
---|
16 | |
---|
17 | protected function tearDown() |
---|
18 | { |
---|
19 | parent::tearDown(); |
---|
20 | } |
---|
21 | |
---|
22 | ///////////////////////////////////////// |
---|
23 | |
---|
24 | public function testReduceStock_減少数0はFalse() |
---|
25 | { |
---|
26 | $this->setUpProductClass(); |
---|
27 | $this->setUpProducts(); |
---|
28 | $this->setUpClassCategory(); |
---|
29 | |
---|
30 | $productClassId = '1001'; |
---|
31 | $quantity = '0'; |
---|
32 | $this->expected = false; |
---|
33 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
34 | |
---|
35 | $this->verify('減少数0'); |
---|
36 | } |
---|
37 | |
---|
38 | public function testReduceStock_減少数1はTrue() |
---|
39 | { |
---|
40 | $this->setUpProductClass(); |
---|
41 | $this->setUpProducts(); |
---|
42 | $this->setUpClassCategory(); |
---|
43 | |
---|
44 | $productClassId = '1001'; |
---|
45 | $quantity = '1'; |
---|
46 | $this->expected = true; |
---|
47 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
48 | |
---|
49 | $this->verify('減少数1'); |
---|
50 | } |
---|
51 | |
---|
52 | public function testReduceStock_在庫数をマイナスにする数はFalse() |
---|
53 | { |
---|
54 | $this->setUpProductClass(); |
---|
55 | $this->setUpProducts(); |
---|
56 | $this->setUpClassCategory(); |
---|
57 | |
---|
58 | $productClassId = '1001'; |
---|
59 | $quantity = '100'; |
---|
60 | $this->expected = false; |
---|
61 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
62 | |
---|
63 | $this->verify('在庫数マイナス'); |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | public function testReduceStock_在庫数無限の場合はTrue() |
---|
68 | { |
---|
69 | $this->setUpProductClass(); |
---|
70 | $this->setUpProducts(); |
---|
71 | $this->setUpClassCategory(); |
---|
72 | |
---|
73 | $productClassId = '1002'; |
---|
74 | $quantity = '100'; |
---|
75 | $this->expected = true; |
---|
76 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
77 | |
---|
78 | $this->verify('在庫数無限'); |
---|
79 | } |
---|
80 | } |
---|