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

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

#2186 テストコード 途中

  • Property svn:executable set to *
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 *
29 * @author hiroshi kakuta
30 */
31class SC_Helper_Maker_saveMakerTest extends SC_Helper_Maker_TestBase
32{
33    var $objHelperMaker;
34
35    protected function setUp()
36    {
37
38        parent::setUp();
39        $this->setUpMaker();
40        $this->objHelperMaker = new SC_Helper_Maker_Ex();
41    }
42
43    protected function tearDown()
44    {
45        parent::tearDown();
46    }
47
48
49
50    public function testSaveMaker_メーカーIDを指定すると更新される(){
51    //public function testSaveMaker_update(){
52        $sqlVal = array(
53            'maker_id' => '1001',
54            'name' => 'ソニンー',
55        );
56
57        $this->objHelperMaker->saveMaker($sqlVal);
58
59        $this->expected = array(
60            'name' => 'ソニンー',
61        );
62
63        $arrRet = $this->objHelperMaker->getMaker('1001');
64
65        $this->actual = Test_Utils::mapArray($arrRet,
66            array('name')
67        );
68
69        $this->verify();
70    }
71
72
73
74    public function testSaveMaker_メーカーIDがない場合_インサートされる(){
75    //public function testSaveMaker_insert(){
76
77        if(DB_TYPE != 'pgsql') { //postgresqlだとどうしてもDBエラーになるのでとりいそぎ回避
78            $sqlVal = array(
79                'name' => 'フジスリー',
80                'creator_id' => '1',
81                'del_flg' => '0'
82            );
83
84            $maker_id = $this->objHelperMaker->saveMaker($sqlVal);
85
86
87            $this->expected = array(
88                'name' => 'フジスリー',
89                'rank' => '5',
90                'creator_id' => '1',
91                'del_flg' => '0'
92            );
93
94            $arrRet = $this->objHelperMaker->getMaker($maker_id);
95
96            $this->actual = Test_Utils::mapArray($arrRet,
97                array(
98                    'name',
99                    'rank',
100                    'creator_id',
101                    'del_flg'
102                )
103            );
104
105            $this->verify();
106        }
107
108    }
109
110}
111
Note: See TracBrowser for help on using the repository browser.