source: branches/version-2_13-dev/tests/class/SC_CartSession/SC_CartSession_getAllCartListTest.php @ 23608

Revision 23608, 2.3 KB checked in by kimoto, 10 years ago (diff)

#150 ユニットテスト環境の整備
ファイル名を修正

Line 
1<?php
2
3$HOME = realpath(dirname(__FILE__)) . "/../../..";
4require_once($HOME . "/tests/class/SC_CartSession/SC_CartSession_TestBase.php");
5
6/**
7 * SC_CartSession_getAllCartList
8 *
9 * @package
10 * @version $id$
11 * @copyright
12 * @author Nobuhiko Kimoto <info@nob-log.info>
13 * @license
14 */
15class SC_CartSession_getAllCartListTest extends SC_CartSession_TestBase
16{
17
18    protected function setUp()
19    {
20        parent::setUp();
21        $this->objCartSession = new SC_CartSession_Ex();
22    }
23
24    protected function tearDown()
25    {
26        parent::tearDown();
27    }
28
29    /////////////////////////////////////////
30
31    /**
32     * @test
33     */
34    public function getAllCartList_商品を追加していなければ空の配列を返す()
35    {
36        $this->setUpProductClass();
37        $this->expected = 0;
38        $this->actual = count($this->objCartSession->getAllCartList());
39
40        $this->verify('商品数');
41    }
42
43    /**
44     * @test
45     */
46    public function getAllCartList_商品を1つ追加した場合1つの配列を返す()
47    {
48        $this->setUpProductClass();
49        $this->expected = 1;
50        $this->objCartSession->addProduct('1001', 1);
51
52        $cartList = $this->objCartSession->getAllCartList();
53        $this->actual = count($cartList);
54
55        $this->verify('カート数');
56
57        return $cartList;
58    }
59
60    /**
61     * @test
62     */
63    public function getAllCartList_違う商品種別の商品を追加した場合用品種別分の配列を返す()
64    {
65        $this->setUpProductClass();
66        $this->expected = 2;
67        $this->objCartSession->addProduct('1001', 1);
68        $this->objCartSession->addProduct('1002', 1);
69
70        $cartList = $this->objCartSession->getAllCartList();
71        $this->actual = count($cartList);
72
73        $this->verify('カート数');
74
75        return $cartList;
76    }
77
78    /**
79     * @test
80     */
81    public function getAllCartList_複数回呼んでも同じ内容が返される()
82    {
83        $this->setUpProductClass();
84        $this->objCartSession->addProduct('1001', 1);
85        $this->objCartSession->addProduct('1002', 1);
86
87        $this->expected = $this->objCartSession->getAllCartList();
88        $this->actual = $this->objCartSession->getAllCartList();
89
90        $this->verify('カートの内容');
91
92        return $cartList;
93    }
94
95}
Note: See TracBrowser for help on using the repository browser.