source: branches/version-2_13-dev/tests/class/helper/SC_Helper_Address/SC_Helper_Address_registAddressTest.php @ 22723

Revision 22723, 3.5 KB checked in by tokuhiro, 11 years ago (diff)

#2189 SC_Helper_Addressのテストケースを追加

Line 
1<?php
2
3$HOME = realpath(dirname(__FILE__)) . "/../../../..";
4require_once($HOME . "/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php");
5/**
6 *
7 */
8class SC_Helper_Address_registAddressTest extends SC_Helper_Address_TestBase
9{
10
11    protected function setUp()
12    {
13        parent::setUp();
14        $this->objAddress = new SC_Helper_Address_Ex();
15    }
16
17    protected function tearUp()
18    {
19        parent::tearUp();
20    }
21
22    /////////////////////////////////////////
23
24//顧客idがない場合は直にExitしてしまうので未実行
25/*
26    public function testregistAddressTest_顧客idが無い場合_システムエラーを返す()
27    {
28        $objQuery =& SC_Query_Ex::getSingletonInstance();
29        $this->setUpAddress();
30        //$this->expected = "1";
31        $this->objAddress->registAddress(null);
32        $this->actual = '';
33        $this->verify('アドレス追加');
34    }
35*/
36
37
38    public function testregistAddressTest_会員の登録配送先を追加する()
39    {
40         if(DB_TYPE != 'pgsql') { //postgresqlだとどうしてもDBエラーになるのでとりいそぎ回避
41            $this->setUpAddress();
42            $arrSql =
43                array(
44                    'customer_id' => '1',
45                    'name01' => 'テスト',
46                    'name02' => 'よん',
47                    'kana01' => 'テスト',
48                    'kana02' => 'ヨン',
49                    'zip01' => '333',
50                    'zip02'=> '3333',
51                    'pref' => '4',
52                    'addr01' => 'テスト4',
53                    'addr02' => 'テスト4',
54                    'tel01' => '001',
55                    'tel02' => '0002',
56                    'tel03' => '0003',
57                    'fax01' => '112',
58                    'fax02' => '1113',
59                    'fax03' => '1114'
60                );
61            $objQuery =& SC_Query_Ex::getSingletonInstance();
62            $this->expected = '1002';
63            $this->objAddress->registAddress($arrSql);
64            $col = 'other_deliv_id';
65            $from = 'dtb_other_deliv';
66            $where = 'other_deliv_id = ?';
67            $arrWhere = array($this->expected);
68            $ret = $objQuery->select($col, $from, $where, $arrWhere);
69            $this->actual = $ret['other_deliv_id'];
70            $this->verify('アドレス追加');
71        }
72    }
73
74
75    public function testregistAddressTest_会員の登録配送先を更新する()
76    {
77        $this->setUpAddress();
78        $arrSql =
79            array(
80                'other_deliv_id' => '1000',
81                'customer_id' => '1',
82                'name01' => 'テスト',
83                'name02' => '更新',
84                'kana01' => 'テスト',
85                'kana02' => 'コウシン',
86                'zip01' => '222',
87                'zip02'=> '2222',
88                'pref' => '4',
89                'addr01' => 'テスト1',
90                'addr02' => 'テスト1',
91                'tel01' => '001',
92                'tel02' => '0002',
93                'tel03' => '0003',
94                'fax01' => '112',
95                'fax02' => '1113',
96                'fax03' => '1114'
97            );
98        $objQuery =& SC_Query_Ex::getSingletonInstance();
99        $this->objAddress->registAddress($arrSql);
100
101        $this->expected = $arrSql;
102        $col = '*';
103        $from = 'dtb_other_deliv';
104        $where = 'other_deliv_id = ?';
105        $arrWhere = array($arrSql['other_deliv_id']);
106        $this->actual = $objQuery->getRow($col, $from, $where, $arrWhere);
107       
108        $this->verify('登録配送先更新');
109    }
110
111
112
113
114}
Note: See TracBrowser for help on using the repository browser.