source: branches/version-2_12-dev/tests/class/SC_Product/SC_Product_getBuyLimitTest.php @ 22192

Revision 22192, 2.3 KB checked in by poego, 11 years ago (diff)

#1993 SC_Productテスト関数の命名を修正

Line 
1<?php
2
3$HOME = realpath(dirname(__FILE__)) . "/../../..";
4require_once($HOME . "/tests/class/SC_Product/SC_Product_TestBase.php");
5/**
6 *
7 */
8class SC_Product_getBuyLimitTest 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 testGetBuyLimit_商品数無限の場合販売制限なし() {
22       
23        $product = array('stock_unlimited' => '1'
24                        ,'sale_limit' => null
25                        ,'stock' => null);
26        $this->expected = null;
27        $this->actual = $this->objProducts->getBuyLimit($product);
28
29        $this->verify('販売制限なし');
30    }
31   
32    public function testGetBuyLimit_商品販売数制限数を返す() {
33       
34        $product = array('stock_unlimited' => '1'
35                        ,'sale_limit' => 3
36                        ,'stock' => null);
37        $this->expected = 3;
38        $this->actual = $this->objProducts->getBuyLimit($product);
39
40        $this->verify('販売数制限');
41    }
42   
43    public function testGetBuyLimit_商品在庫数を制限として返す() {
44       
45        $product = array('stock_unlimited' => null
46                        ,'sale_limit' => null
47                        ,'stock' => 5);
48        $this->expected = 5;
49        $this->actual = $this->objProducts->getBuyLimit($product);
50
51        $this->verify('在庫数制限');
52    }
53
54    public function testGetBuyLimit_販売制限数大なり在庫数なら在庫数を返す() {
55       
56        $product = array('stock_unlimited' => null
57                        ,'sale_limit' => 5
58                        ,'stock' => 2);
59        $this->expected = 2;
60        $this->actual = $this->objProducts->getBuyLimit($product);
61
62        $this->verify('販売数>在庫数制限');
63    }
64   
65    public function testGetBuyLimit_販売制限数少なり在庫数なら販売制限数() {
66       
67        $product = array('stock_unlimited' => null
68                        ,'sale_limit' => 5
69                        ,'stock' => 99);
70        $this->expected = 5;
71        $this->actual = $this->objProducts->getBuyLimit($product);
72
73        $this->verify('販売数<在庫数制限');
74    }
75
76
77   
78}
Note: See TracBrowser for help on using the repository browser.