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 | protected function setUp() { |
---|
11 | parent::setUp(); |
---|
12 | $this->objProducts = new SC_Product_Ex(); |
---|
13 | } |
---|
14 | |
---|
15 | protected function tearDown() { |
---|
16 | parent::tearDown(); |
---|
17 | } |
---|
18 | |
---|
19 | ///////////////////////////////////////// |
---|
20 | |
---|
21 | public function testReduceStock_減少数0はFalse() { |
---|
22 | $this->setUpProductClass(); |
---|
23 | $this->setUpProducts(); |
---|
24 | $this->setUpClassCategory(); |
---|
25 | |
---|
26 | $productClassId = '1001'; |
---|
27 | $quantity = '0'; |
---|
28 | $this->expected = false; |
---|
29 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
30 | |
---|
31 | $this->verify('減少数0'); |
---|
32 | } |
---|
33 | |
---|
34 | public function testReduceStock_減少数1はTrue() { |
---|
35 | $this->setUpProductClass(); |
---|
36 | $this->setUpProducts(); |
---|
37 | $this->setUpClassCategory(); |
---|
38 | |
---|
39 | $productClassId = '1001'; |
---|
40 | $quantity = '1'; |
---|
41 | $this->expected = true; |
---|
42 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
43 | |
---|
44 | $this->verify('減少数1'); |
---|
45 | } |
---|
46 | |
---|
47 | public function testReduceStock_在庫数をマイナスにする数はFalse() { |
---|
48 | $this->setUpProductClass(); |
---|
49 | $this->setUpProducts(); |
---|
50 | $this->setUpClassCategory(); |
---|
51 | |
---|
52 | $productClassId = '1001'; |
---|
53 | $quantity = '100'; |
---|
54 | $this->expected = false; |
---|
55 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
56 | |
---|
57 | $this->verify('在庫数マイナス'); |
---|
58 | } |
---|
59 | |
---|
60 | |
---|
61 | public function testReduceStock_在庫数無限の場合はTrue() { |
---|
62 | $this->setUpProductClass(); |
---|
63 | $this->setUpProducts(); |
---|
64 | $this->setUpClassCategory(); |
---|
65 | |
---|
66 | $productClassId = '1002'; |
---|
67 | $quantity = '100'; |
---|
68 | $this->expected = true; |
---|
69 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
70 | |
---|
71 | $this->verify('在庫数無限'); |
---|
72 | } |
---|
73 | } |
---|