Revision 23555,
1.7 KB
checked in by shutta, 10 years ago
(diff) |
#1993 [共通クラス]SC_Product
dtb_classテーブルのデータ初期化が漏れていたので追加。(必要なデータはクラス内で用意させる)
setUp周りの冗長な処理を改善。
|
Line | |
---|
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->setUpProductClass(); |
---|
15 | $this->objProducts = new SC_Product_Ex(); |
---|
16 | } |
---|
17 | |
---|
18 | protected function tearDown() |
---|
19 | { |
---|
20 | parent::tearDown(); |
---|
21 | } |
---|
22 | |
---|
23 | ///////////////////////////////////////// |
---|
24 | |
---|
25 | public function testReduceStock_減少数0はFalse() |
---|
26 | { |
---|
27 | $productClassId = '1001'; |
---|
28 | $quantity = '0'; |
---|
29 | $this->expected = false; |
---|
30 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
31 | |
---|
32 | $this->verify('減少数0'); |
---|
33 | } |
---|
34 | |
---|
35 | public function testReduceStock_減少数1はTrue() |
---|
36 | { |
---|
37 | $productClassId = '1001'; |
---|
38 | $quantity = '1'; |
---|
39 | $this->expected = true; |
---|
40 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
41 | |
---|
42 | $this->verify('減少数1'); |
---|
43 | } |
---|
44 | |
---|
45 | public function testReduceStock_在庫数をマイナスにする数はFalse() |
---|
46 | { |
---|
47 | $productClassId = '1001'; |
---|
48 | $quantity = '100'; |
---|
49 | $this->expected = false; |
---|
50 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
51 | |
---|
52 | $this->verify('在庫数マイナス'); |
---|
53 | } |
---|
54 | |
---|
55 | |
---|
56 | public function testReduceStock_在庫数無限の場合はTrue() |
---|
57 | { |
---|
58 | $productClassId = '1002'; |
---|
59 | $quantity = '100'; |
---|
60 | $this->expected = true; |
---|
61 | $this->actual = $this->objProducts->reduceStock($productClassId, $quantity); |
---|
62 | |
---|
63 | $this->verify('在庫数無限'); |
---|
64 | } |
---|
65 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.