source: branches/version-2_13-dev/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetBasisDataTest.php @ 22960

Revision 22960, 7.8 KB checked in by Seasoft, 11 years ago (diff)

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

  • 語句統一「全て」
Line 
1<?php
2
3$HOME = realpath(dirname(__FILE__)) . "/../../../..";
4require_once($HOME . "/tests/class/helper/SC_Helper_DB/SC_Helper_DB_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_DB::sfGetBasisData()のテストクラス.
29 *
30 * @author Hiroko Tamagawa
31 * @version $Id: SC_Helper_DB_sfGetBasisData.php 22567 2013-02-18 10:09:54Z shutta $
32 */
33class SC_Helper_DB_sfGetBasisData extends SC_Helper_DB_TestBase
34{
35
36    protected function setUp()
37    {
38        parent::setUp();
39        $this->helper = new SC_Helper_DB_Ex();
40    }
41
42    protected function tearDown()
43    {
44        parent::tearDown();
45    }
46
47    /////////////////////////////////////////
48    public function testsfGetBasisData_条件を指定しない場合_baseinfoを全て返す()
49    {
50        $this->setUpBasisData();
51        $this->expected = array(
52            'id' => '1',
53            'company_name' => 'testshop',
54            'company_kana' => 'テストショップ',
55            'zip01' => '530',
56            'zip02' => '0001',
57            'country_id' => null,
58            'pref' => '1',
59            'addr01' => 'testaddr01',
60            'addr02' => 'testaddr02',
61            'tel01' => '11',
62            'tel02' => '2222',
63            'tel03' => '3333',
64            'fax01' => '11',
65            'fax02' => '2222',
66            'fax03' => '3333',
67            'business_hour' => '09-18',
68            'law_company' => 'lawcampanyname',
69            'law_manager' => 'lawmanager',
70            'law_zip01' => '530',
71            'law_zip02' => '0001',
72            'law_country_id' => null,
73            'law_pref' => '1',
74            'law_addr01' => 'lawaddr01',
75            'law_addr02' => 'lawaddr02',
76            'law_tel01' => '11',
77            'law_tel02' => '2222',
78            'law_tel03' => '3333',
79            'law_fax01' => '11',
80            'law_fax02' => '2222',
81            'law_fax03' => '3333',
82            'law_email' => 'test@test.com',
83            'law_url' => 'http://test.test',
84            'law_term01' => 'lawterm01',
85            'law_term02' => 'lawterm02',
86            'law_term03' => 'lawterm03',
87            'law_term04' => 'lawterm04',
88            'law_term05' => 'lawterm05',
89            'law_term06' => 'lawterm06',
90            'law_term07' => 'lawterm07',
91            'law_term08' => 'lawterm08',
92            'law_term09' => 'lawterm09',
93            'law_term10' => 'lawterm10',
94            'email01' => 'test1@test.com',
95            'email02' => 'test2@test.com',
96            'email03' => 'test3@test.com',
97            'email04' => 'test4@test.com',
98            'free_rule' => '1000',
99            'shop_name' => 'shopname',
100            'shop_kana' => 'ショップネーム',
101            'shop_name_eng' => 'shopnameeng',
102            'point_rate' => '10',
103            'welcome_point' => '100',
104            'update_date' => '2012-02-14 11:22:33',
105            'top_tpl' => 'top.tpl',
106            'product_tpl' => 'product.tpl',
107            'detail_tpl' => 'detail.tpl',
108            'mypage_tpl' => 'mypage.tpl',
109            'good_traded' => 'goodtraded',
110            'message' => 'message',
111            'regular_holiday_ids' => '0|6',
112            'latitude' => '30.0001',
113            'longitude' => '45.0001',
114            'downloadable_days' => '10',
115            'downloadable_days_unlimited' => '0'
116        );
117        $this->actual = $this->helper->sfGetBasisData(true);
118        $this->verify();
119    }
120
121    /* r22841 の仕様変更により廃止
122    public function testsfGetBasisData_カラムを指定する場合_指定のカラムだけを返す()
123    {
124        $this->setUpBasisData();
125        $this->expected = array(
126            'id' => '1',
127            'company_name' => 'testshop'
128        );
129        $force = true;
130        $col = 'id, company_name';
131        $this->actual = $this->helper->sfGetBasisData($force, $col);
132        $this->verify();
133    }
134    */
135
136    public function testsfGetBasisData_baseinfoが空の場合_空を返す()
137    {
138        $this->objQuery->delete('dtb_baseinfo');
139        $this->expected = null;
140        $this->actual = $this->helper->sfGetBasisData(true);
141        $this->verify();
142    }
143   
144    public function testsfGetBasisData_forceがfalseの場合_キャッシュを返す()
145    {
146        $this->setUpBasisData();
147        $force = true;
148        //事前にキャッシュを生成
149        $this->actual = $this->helper->sfGetBasisData($force);
150        //baseinfoを空にしてしまう
151        $this->objQuery->delete('dtb_baseinfo');
152        $force = false;
153        $this->expected = array(
154            'id' => '1',
155            'company_name' => 'testshop',
156            'company_kana' => 'テストショップ',
157            'zip01' => '530',
158            'zip02' => '0001',
159            'pref' => '1',
160            'addr01' => 'testaddr01',
161            'addr02' => 'testaddr02',
162            'tel01' => '11',
163            'tel02' => '2222',
164            'tel03' => '3333',
165            'fax01' => '11',
166            'fax02' => '2222',
167            'fax03' => '3333',
168            'business_hour' => '09-18',
169            'law_company' => 'lawcampanyname',
170            'law_manager' => 'lawmanager',
171            'law_zip01' => '530',
172            'law_zip02' => '0001',
173            'law_pref' => '1',
174            'law_addr01' => 'lawaddr01',
175            'law_addr02' => 'lawaddr02',
176            'law_tel01' => '11',
177            'law_tel02' => '2222',
178            'law_tel03' => '3333',
179            'law_fax01' => '11',
180            'law_fax02' => '2222',
181            'law_fax03' => '3333',
182            'law_email' => 'test@test.com',
183            'law_url' => 'http://test.test',
184            'law_term01' => 'lawterm01',
185            'law_term02' => 'lawterm02',
186            'law_term03' => 'lawterm03',
187            'law_term04' => 'lawterm04',
188            'law_term05' => 'lawterm05',
189            'law_term06' => 'lawterm06',
190            'law_term07' => 'lawterm07',
191            'law_term08' => 'lawterm08',
192            'law_term09' => 'lawterm09',
193            'law_term10' => 'lawterm10',
194            'email01' => 'test1@test.com',
195            'email02' => 'test2@test.com',
196            'email03' => 'test3@test.com',
197            'email04' => 'test4@test.com',
198            'free_rule' => '1000',
199            'shop_name' => 'shopname',
200            'shop_kana' => 'ショップネーム',
201            'shop_name_eng' => 'shopnameeng',
202            'point_rate' => '10',
203            'welcome_point' => '100',
204            'update_date' => '2012-02-14 11:22:33',
205            'top_tpl' => 'top.tpl',
206            'product_tpl' => 'product.tpl',
207            'detail_tpl' => 'detail.tpl',
208            'mypage_tpl' => 'mypage.tpl',
209            'good_traded' => 'goodtraded',
210            'message' => 'message',
211            'regular_holiday_ids' => '0|6',
212            'latitude' => '30.0001',
213            'longitude' => '45.0001',
214            'downloadable_days' => '10',
215            'downloadable_days_unlimited' => '0',
216            'country_id' => null,
217            'law_country_id' => null
218        );
219        $this->actual = $this->helper->sfGetBasisData(false);
220        $this->verify();
221    }
222}
Note: See TracBrowser for help on using the repository browser.