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

Revision 22856, 3.6 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_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_getByNameTest 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    public function testGetByName_メーカー名が存在しない場合_空を返す()
50    {
51        $this->expected = null;
52
53        $this->actual = $this->objHelperMaker->getByName("ソニ");
54
55        $this->verify();
56    }
57
58    // maker_idが存在する場合、対応した結果を取得できる。
59    public function testGetByName_メーカー名が存在する場合_対応した結果を取得できる(){
60
61
62        $this->expected = array(
63            'maker_id' => '1001',
64            'name' => 'ソニン',
65            'rank' => '1',
66            'creator_id' => '1',
67            'create_date' => '2000-01-01 00:00:00',
68            'update_date' => '2000-01-01 00:00:00',
69            'del_flg' => '0'
70        );
71
72        $result = $this->objHelperMaker->getByName("ソニン");
73
74        $this->actual = Test_Utils::mapArray($result,
75            array('maker_id',
76                'name',
77                'rank',
78                'creator_id',
79                'create_date',
80                'update_date',
81                'del_flg'
82            ));
83
84        $this->verify();
85
86    }
87
88    public function testGetByName_おすすめIDがあり_かつ削除済みの場合_空が返る(){
89
90        $this->expected = null;
91
92        $result = $this->objHelperMaker->getMaker("1002");
93
94        $this->verify();
95
96    }
97
98    // best_idが存在するが、del_flg=1の場合、かつ。$has_deleted=trueを指定
99    public function testGetByName_削除済みでかつhas_deletedがtrueの場合_対応した結果が返る(){
100
101        $best_id = '1002';
102
103
104        $this->expected = array(
105            'maker_id' => '1002',
106            'name' => 'パソナニック',
107            'rank' => '2',
108            'creator_id' => '2',
109            'create_date' => '2000-01-01 00:00:00',
110            'update_date' => '2000-01-01 00:00:00',
111            'del_flg' => '1'
112        );
113
114        $result = $this->objHelperMaker->getMaker("1002",true);
115
116        $this->actual = Test_Utils::mapArray($result,
117            array('maker_id',
118                'name',
119                'rank',
120                'creator_id',
121                'create_date',
122                'update_date',
123                'del_flg'
124            ));
125
126        $this->verify();
127    }
128}
129
Note: See TracBrowser for help on using the repository browser.