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

Revision 22567, 2.3 KB checked in by shutta, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
Zend Framework PHP 標準コーディング規約のコーディングスタイルへ準拠。
classおよびfunctionの開始波括弧「{」のスタイルを修正。

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