source: branches/version-2_13-dev/tests/class/helper/SC_Helper_Maker/SC_Helper_Maker_getMakerTest.php @ 22727

Revision 22727, 3.6 KB checked in by hiro151, 11 years ago (diff)

#2186 テストコード 途中

  • 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_Maker/SC_Helper_Maker_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_Maker::getMaker()のテストクラス.
29 *
30 * @author hiroshi kakuta
31 */
32class SC_Helper_Maker_getMakerTest extends SC_Helper_Maker_TestBase
33{
34
35    var $objHelperMaker;
36
37    protected function setUp()
38    {
39        parent::setUp();
40        $this->setUpMaker();
41        $this->objHelperMaker = new SC_Helper_Maker_Ex();
42    }
43
44    protected function tearDown()
45    {
46        parent::tearDown();
47    }
48
49    /** maker_idが存在しない場合、空を返す。
50     */
51    public function testGetMaker_おすすめidが存在しない場合_空を返す()
52    {
53        $this->expected = null;
54
55        $this->actual = $this->objHelperMaker->getMaker("9999");
56
57        $this->verify();
58    }
59
60    // maker_idが存在する場合、対応した結果を取得できる。
61    public function testGetMaker_メーカーIDが存在する場合_対応した結果を取得できる(){
62
63
64        $this->expected = array(
65            'maker_id' => '1001',
66            'name' => 'ソニン',
67            'rank' => '1',
68            'creator_id' => '1',
69            'create_date' => '2000-01-01 00:00:00',
70            'update_date' => '2000-01-01 00:00:00',
71            'del_flg' => '0'
72        );
73
74        $result = $this->objHelperMaker->getMaker("1001");
75
76        $this->actual = Test_Utils::mapArray($result,
77            array('maker_id',
78                'name',
79                'rank',
80                'creator_id',
81                'create_date',
82                'update_date',
83                'del_flg'
84            ));
85
86        $this->verify();
87
88    }
89
90
91    public function testGetMaker_おすすめIDがあり_かつ削除済みの場合_空が返る(){
92
93        $this->expected = null;
94
95        $result = $this->objHelperMaker->getMaker("1002");
96
97        $this->verify();
98
99    }
100
101    // best_idが存在するが、del_flg=1の場合、かつ。$has_deleted=trueを指定
102    public function testGetMaker_削除済みでかつhas_deletedがtrueの場合_対応した結果が返る(){
103
104        $best_id = '1002';
105
106
107        $this->expected = array(
108            'maker_id' => '1002',
109            'name' => 'パソナニック',
110            'rank' => '2',
111            'creator_id' => '2',
112            'create_date' => '2000-01-01 00:00:00',
113            'update_date' => '2000-01-01 00:00:00',
114            'del_flg' => '1'
115        );
116
117        $result = $this->objHelperMaker->getMaker("1002",true);
118
119        $this->actual = Test_Utils::mapArray($result,
120            array('maker_id',
121                'name',
122                'rank',
123                'creator_id',
124                'create_date',
125                'update_date',
126                'del_flg'
127            ));
128
129        $this->verify();
130    }
131}
132
Note: See TracBrowser for help on using the repository browser.