source: branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_BestProducts/SC_Helper_BestProducts_getBestProductsTest.php @ 22660

Revision 22660, 3.6 KB checked in by hiro151, 8 years ago (diff)

#2183 テストfunction名の修正

  • Property svn:keywords set to Id Rev Date
Line 
1<?php
2
3$HOME = realpath(dirname(__FILE__)) . "/../../../..";
4require_once($HOME . "/tests/class/helper/SC_Helper_BestProducts/SC_Helper_BestProducts_TestBase.php");
5/*
6 * This file is part of EC-CUBE
7 *
8 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
9 *
10 * http://www.lockon.co.jp/
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25 */
26
27/**
28 * SC_Helper_BestProducts::getBestProducts()のテストクラス.
29 *
30 * @author hiroshi kakuta
31 */
32class SC_Helper_BestProducts_getBestProductsTest extends SC_Helper_BestProducts_TestBase
33{
34    protected function setUp()
35    {
36        parent::setUp();
37        $this->setUpBestProducts();
38    }
39
40    protected function tearDown()
41    {
42        parent::tearDown();
43    }
44
45    /** best_idが存在しない場合、空を返す。
46     */
47    public function testGetBestProducts_おすすめidが存在しない場合_空を返す()
48    {
49        $best_id = '9999';
50
51        $this->expected = null;
52        $this->actual = SC_Helper_BestProducts::getBestProducts($best_id);
53
54        $this->verify();
55    }
56
57    // best_idが存在する場合、対応した結果を取得できる。
58    public function testGetBestProducts_おすすめIDが存在する場合_対応した結果を取得できる(){
59
60        $best_id = '1001';
61
62
63        $this->expected = array(
64            'category_id' => '0',
65            'rank' => '1',
66            'title' => 'タイトルですよ',
67            'comment' => 'コメントですよ',
68            'del_flg' => '0'
69        );
70
71        $result = SC_Helper_BestProducts::getBestProducts($best_id);
72        $this->actual = Test_Utils::mapArray($result,
73            array('category_id',
74                'rank',
75                'title',
76                'comment',
77                'del_flg'
78            ));
79
80        $this->verify();
81
82    }
83
84
85    // best_idが存在するが、del_flg=1の場合、空が帰る。
86    public function testGetBestProducts_おすすめIDがあり_かつ削除済みの場合_空が返る(){
87
88        $best_id = '1002';
89
90        $this->expected = null;
91        $this->actual = SC_Helper_BestProducts::getBestProducts($best_id);
92
93        $this->verify();
94
95    }
96
97    // best_idが存在するが、del_flg=1の場合、かつ。$has_deleted=trueを指定
98    public function testGetBestProducts_削除済みでかつhas_deletedがtrueの場合_対応した結果が返る(){
99
100        $best_id = '1002';
101
102
103        $this->expected = array(
104            'category_id' => '0',
105            'rank' => '2',
106            'title' => 'タイトルですよ',
107            'comment' => 'コメントですよ',
108            'del_flg' => '1'
109        );
110
111        $result = SC_Helper_BestProducts::getBestProducts($best_id,true);
112        $this->actual = Test_Utils::mapArray($result,
113            array('category_id',
114                'rank',
115                'title',
116                'comment',
117                'del_flg'
118            ));
119
120        $this->verify();
121    }
122}
123
Note: See TracBrowser for help on using the repository browser.