source: branches/version-2_13-dev/tests/class/helper/SC_Helper_BestProducts/SC_Helper_BestProducts_getBestProductsTest.php @ 22856

Revision 22856, 3.6 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。もう少し整えたいが、一旦現状コミット。
  • 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_Ex::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_Ex::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    // best_idが存在するが、del_flg=1の場合、空が帰る。
85    public function testGetBestProducts_おすすめIDがあり_かつ削除済みの場合_空が返る(){
86
87        $best_id = '1002';
88
89        $this->expected = null;
90        $this->actual = SC_Helper_BestProducts_Ex::getBestProducts($best_id);
91
92        $this->verify();
93
94    }
95
96    // best_idが存在するが、del_flg=1の場合、かつ。$has_deleted=trueを指定
97    public function testGetBestProducts_削除済みでかつhas_deletedがtrueの場合_対応した結果が返る(){
98
99        $best_id = '1002';
100
101
102        $this->expected = array(
103            'category_id' => '0',
104            'rank' => '2',
105            'title' => 'タイトルですよ',
106            'comment' => 'コメントですよ',
107            'del_flg' => '1'
108        );
109
110        $result = SC_Helper_BestProducts_Ex::getBestProducts($best_id,true);
111        $this->actual = Test_Utils::mapArray($result,
112            array('category_id',
113                'rank',
114                'title',
115                'comment',
116                'del_flg'
117            ));
118
119        $this->verify();
120    }
121}
122
Note: See TracBrowser for help on using the repository browser.