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

Revision 22857, 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_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    public function testGetMaker_おすすめIDがあり_かつ削除済みの場合_空が返る(){
90
91        $this->expected = null;
92
93        $result = $this->objHelperMaker->getMaker("1002");
94
95        $this->verify();
96    }
97
98    // best_idが存在するが、del_flg=1の場合、かつ。$has_deleted=trueを指定
99    public function testGetMaker_削除済みでかつhas_deletedがtrueの場合_対応した結果が返る(){
100
101        $best_id = '1002';
102
103        $this->expected = array(
104            'maker_id' => '1002',
105            'name' => 'パソナニック',
106            'rank' => '2',
107            'creator_id' => '2',
108            'create_date' => '2000-01-01 00:00:00',
109            'update_date' => '2000-01-01 00:00:00',
110            'del_flg' => '1'
111        );
112
113        $result = $this->objHelperMaker->getMaker("1002",true);
114
115        $this->actual = Test_Utils::mapArray($result,
116            array('maker_id',
117                'name',
118                'rank',
119                'creator_id',
120                'create_date',
121                'update_date',
122                'del_flg'
123            ));
124
125        $this->verify();
126    }
127}
128
Note: See TracBrowser for help on using the repository browser.