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