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

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