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

Revision 22857, 5.9 KB checked in by Seasoft, 11 years ago (diff)

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

  • 主に空白・空白行の調整。
  • Property svn:executable set to *
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::getList()のテストクラス.
29 *
30 * @author hiroshi kakuta
31 */
32class SC_Helper_BestProducts_getListTest extends SC_Helper_BestProducts_TestBase
33{
34    protected function setUp()
35    {
36        parent::setUp();
37    }
38
39    protected function tearDown()
40    {
41        parent::tearDown();
42    }
43
44    /** rankが存在しない場合、空を返す。
45     */
46    public function testGetList_存在しない場合空を返す()
47    {
48
49        $this->deleteAllBestProducts();
50
51        $this->expected = array();
52        $this->actual = SC_Helper_BestProducts_Ex::getList();
53
54        $this->verify();
55    }
56
57    public function testGetList_データがある場合_想定した結果が返る(){
58
59        $this->setUpBestProducts();
60
61        $this->expected = array(
62            0=>array(
63                'best_id' => '1001',
64                'product_id'=>'2',
65                'category_id' => '0',
66                'rank' => '1',
67                'title' => 'タイトルですよ',
68                'comment' => 'コメントですよ',
69                'creator_id' => '1',
70                'create_date' => '2000-01-01 00:00:00',
71                'update_date' => '2000-01-01 00:00:00',
72                'del_flg' => '0'
73            ),
74            1=>array(
75                'best_id' => '1003',
76                'product_id'=>'3',
77                'category_id' => '1',
78                'rank' => '3',
79                'title' => 'タイトルですよ3',
80                'comment' => 'コメントですよ3',
81                'creator_id' => '3',
82                'create_date' => '2000-01-01 00:00:00',
83                'update_date' => '2000-01-01 00:00:00',
84                'del_flg' => '0'
85
86            )
87        );
88
89        $this->actual = SC_Helper_BestProducts_Ex::getList();
90        $this->verify();
91    }
92
93    public function testGetList_一覧取得has_deleteをtrueにした場合削除済みデータも取得(){
94
95        $this->setUpBestProducts();
96
97        $this->expected = array(
98            0=>array(
99                'best_id' => '1001',
100                'product_id'=>'2',
101                'category_id' => '0',
102                'rank' => '1',
103                'title' => 'タイトルですよ',
104                'comment' => 'コメントですよ',
105                'creator_id' => '1',
106                'create_date' => '2000-01-01 00:00:00',
107                'update_date' => '2000-01-01 00:00:00',
108                'del_flg' => '0'
109            ),
110            1=>array(
111                'best_id' => '1002',
112                'product_id'=>'1',
113                'category_id' => '0',
114                'rank' => '2',
115                'title' => 'タイトルですよ',
116                'comment' => 'コメントですよ',
117                'creator_id' => '1',
118                'create_date' => '2000-01-01 00:00:00',
119                'update_date' => '2000-01-01 00:00:00',
120                'del_flg' => '1'
121            ),
122            2=>array(
123                'best_id' => '1003',
124                'product_id'=>'3',
125                'category_id' => '1',
126                'rank' => '3',
127                'title' => 'タイトルですよ3',
128                'comment' => 'コメントですよ3',
129                'creator_id' => '3',
130                'create_date' => '2000-01-01 00:00:00',
131                'update_date' => '2000-01-01 00:00:00',
132                'del_flg' => '0'
133
134            )
135        );
136
137        $this->actual = SC_Helper_BestProducts_Ex::getList(0,0,true);
138        $this->verify();
139    }
140
141    public function testGetList_ページングが想定した結果が返る_表示件数1_ページ番号2(){
142
143        $this->setUpBestProducts();
144
145        $this->expected = array(
146            0=>array(
147                'best_id' => '1003',
148                'product_id'=>'3',
149                'category_id' => '1',
150                'rank' => '3',
151                'title' => 'タイトルですよ3',
152                'comment' => 'コメントですよ3',
153                'creator_id' => '3',
154                'create_date' => '2000-01-01 00:00:00',
155                'update_date' => '2000-01-01 00:00:00',
156                'del_flg' => '0'
157            )
158        );
159
160        $this->actual = SC_Helper_BestProducts_Ex::getList(1,2);
161        $this->verify();
162    }
163
164    public function testGetList_ページングが想定した結果が返る_表示件数1_ページ番号0(){
165
166        $this->setUpBestProducts();
167
168        $this->expected = array(
169            0=>array(
170                'best_id' => '1001',
171                'product_id'=>'2',
172                'category_id' => '0',
173                'rank' => '1',
174                'title' => 'タイトルですよ',
175                'comment' => 'コメントですよ',
176                'creator_id' => '1',
177                'create_date' => '2000-01-01 00:00:00',
178                'update_date' => '2000-01-01 00:00:00',
179                'del_flg' => '0'
180            )
181        );
182
183        $this->actual = SC_Helper_BestProducts_Ex::getList(1,0);
184        $this->verify();
185    }
186}
187
Note: See TracBrowser for help on using the repository browser.