source: branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetBasisDataTest.php @ 22678

Revision 22678, 5.4 KB checked in by poego, 11 years ago (diff)

#2185 SC_Helper_DBが10%くらいできたのでコミット。一部リファクタ

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            'pref' => '1',
58            'addr01' => 'testaddr01',
59            'addr02' => 'testaddr02',
60            'tel01' => '11',
61            'tel02' => '2222',
62            'tel03' => '3333',
63            'fax01' => '11',
64            'fax02' => '2222',
65            'fax03' => '3333',
66            'business_hour' => '09-18',
67            'law_company' => 'lawcampanyname',
68            'law_manager' => 'lawmanager',
69            'law_zip01' => '530',
70            'law_zip02' => '0001',
71            'law_pref' => '1',
72            'law_addr01' => 'lawaddr01',
73            'law_addr02' => 'lawaddr02',
74            'law_tel01' => '11',
75            'law_tel02' => '2222',
76            'law_tel03' => '3333',
77            'law_fax01' => '11',
78            'law_fax02' => '2222',
79            'law_fax03' => '3333',
80            'law_email' => 'test@test.com',
81            'law_url' => 'http://test.test',
82            'law_term01' => 'lawterm01',
83            'law_term02' => 'lawterm02',
84            'law_term03' => 'lawterm03',
85            'law_term04' => 'lawterm04',
86            'law_term05' => 'lawterm05',
87            'law_term06' => 'lawterm06',
88            'law_term07' => 'lawterm07',
89            'law_term08' => 'lawterm08',
90            'law_term09' => 'lawterm09',
91            'law_term10' => 'lawterm10',
92            'tax' => '5',
93            'tax_rule' => '1',
94            'email01' => 'test1@test.com',
95            'email02' => 'test2@test.com',
96            'email03' => 'test3@test.com',
97            'email04' => 'test4@test.com',
98            'email05' => 'test5@test.com',
99            'free_rule' => '1000',
100            'shop_name' => 'shopname',
101            'shop_kana' => 'ショップネーム',
102            'shop_name_eng' => 'shopnameeng',
103            'point_rate' => '10',
104            'welcome_point' => '100',
105            'update_date' => '2012-02-14 11:22:33',
106            'top_tpl' => 'top.tpl',
107            'product_tpl' => 'product.tpl',
108            'detail_tpl' => 'detail.tpl',
109            'mypage_tpl' => 'mypage.tpl',
110            'good_traded' => 'goodtraded',
111            'message' => 'message',
112            'regular_holiday_ids' => '0|6',
113            'latitude' => '30.0001',
114            'longitude' => '45.0001',
115            'downloadable_days' => '10',
116            'downloadable_days_unlimited' => '0'
117        );
118        $this->actual = $this->helper->sfGetBasisData(true);
119        $this->verify();
120    }
121
122   
123    public function testsfGetBasisData_カラムを指定する場合_指定のカラムだけを返す()
124    {
125        $this->setUpBasisData();
126        $this->expected = array(
127            'id' => '1',
128            'company_name' => 'testshop'
129        );
130        $force = true;
131        $col = 'id, company_name';
132        $this->actual = $this->helper->sfGetBasisData($force, $col);
133        $this->verify();
134    }
135   
136    public function testsfGetBasisData_baseinfoが空の場合_空を返す()
137    {
138        $this->objQuery->delete('dtb_baseinfo');
139        $this->expected = array();
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        $col = 'id, company_name';
149        //事前にキャッシュを生成
150        $this->actual = $this->helper->sfGetBasisData($force, $col);
151        //baseinfoを空にしてしまう
152        $this->objQuery->delete('dtb_baseinfo');
153        $force = false;
154        $this->expected = array(
155            'id' => '1',
156            'company_name' => 'testshop'
157        );
158        $this->actual = $this->helper->sfGetBasisData(false);
159        $this->verify();
160    }
161}
Note: See TracBrowser for help on using the repository browser.