Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php	(revision 22723)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php	(revision 22723)
@@ -0,0 +1,74 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../../";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/**
+ *
+ */
+class SC_Helper_Address_TestBase extends Common_TestCase
+{
+    protected function setUp()
+    {
+        parent::setUp();
+    }
+
+    protected function tearDown()
+    {
+        parent::tearDown();
+    }
+
+    /**
+     * DBに規約情報を登録します.
+     */
+    protected function setUpAddress()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        // シーケンス初期化
+        
+        $kiyaku = array(
+            array(
+                'other_deliv_id' => '1000',
+                'customer_id' => '1',
+                'name01' => 'テスト',
+                'name02' => 'いち',
+                'kana01' => 'テスト',
+                'kana02' => 'イチ',
+                'zip01' => '000',
+                'zip02'=> '0000',
+                'pref' => '1',
+                'addr01' => 'テスト',
+                'addr02' => 'テスト２',
+                'tel01' => '000',
+                'tel02' => '0000',
+                'tel03' => '0000',
+                'fax01' => '111',
+                'fax02' => '1111',
+                'fax03' => '1111'
+                  ),
+            array(
+                'other_deliv_id' => '1001',
+                'customer_id' => '1',
+                'name01' => 'テスト',
+                'name02' => 'に',
+                'kana01' => 'テスト',
+                'kana02' => 'ニ',
+                'zip01' => '222',
+                'zip02'=> '2222',
+                'pref' => '2',
+                'addr01' => 'テスト1',
+                'addr02' => 'テスト2',
+                'tel01' => '000',
+                'tel02' => '0000',
+                'tel03' => '0000',
+                'fax01' => '111',
+                'fax02' => '1111',
+                'fax03' => '1111'
+                  )
+                                );
+
+        $this->objQuery->delete('dtb_other_deliv');
+        foreach ($kiyaku as $key => $item) {
+            $ret = $objQuery->insert('dtb_other_deliv', $item);
+        }
+    }
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php	(revision 22723)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php	(revision 22723)
@@ -0,0 +1,106 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Address_getListTest extends SC_Helper_Address_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objAddress = new SC_Helper_Address_Ex();
+    }
+
+    protected function tearUp()
+    {
+        parent::tearUp();
+    }
+
+    /////////////////////////////////////////
+    public function testgetListTest_会員が該当テーブルに存在するかつstart_idが指定されている場合_配送先のarrayを返す()
+    {
+        $this->setUpAddress();
+        $customer_id = '1';
+        $startno = '1';
+        $this->expected = array(
+            array(
+                'other_deliv_id' => '1000',
+                'customer_id' => '1',
+                'name01' => 'テスト',
+                'name02' => 'いち',
+                'kana01' => 'テスト',
+                'kana02' => 'イチ',
+                'zip01' => '000',
+                'zip02'=> '0000',
+                'pref' => '1',
+                'addr01' => 'テスト',
+                'addr02' => 'テスト２',
+                'tel01' => '000',
+                'tel02' => '0000',
+                'tel03' => '0000',
+                'fax01' => '111',
+                'fax02' => '1111',
+                'fax03' => '1111'
+                  )
+
+                                );
+        $this->actual = $this->objAddress->getList($customer_id, $startno);
+        
+        $this->verify('配送先一覧取得');
+    }
+
+    public function testgetListTest_会員が該当テーブルに存在する場合_配送先のarrayを返す()
+    {
+        $this->setUpAddress();
+        $customer_id = '1';
+        $this->expected = array(
+                        array(
+                'other_deliv_id' => '1001',
+                'customer_id' => '1',
+                'name01' => 'テスト',
+                'name02' => 'に',
+                'kana01' => 'テスト',
+                'kana02' => 'ニ',
+                'zip01' => '222',
+                'zip02'=> '2222',
+                'pref' => '2',
+                'addr01' => 'テスト1',
+                'addr02' => 'テスト2',
+                'tel01' => '000',
+                'tel02' => '0000',
+                'tel03' => '0000',
+                'fax01' => '111',
+                'fax02' => '1111',
+                'fax03' => '1111'
+                  ),
+            array(
+                'other_deliv_id' => '1000',
+                'customer_id' => '1',
+                'name01' => 'テスト',
+                'name02' => 'いち',
+                'kana01' => 'テスト',
+                'kana02' => 'イチ',
+                'zip01' => '000',
+                'zip02'=> '0000',
+                'pref' => '1',
+                'addr01' => 'テスト',
+                'addr02' => 'テスト２',
+                'tel01' => '000',
+                'tel02' => '0000',
+                'tel03' => '0000',
+                'fax01' => '111',
+                'fax02' => '1111',
+                'fax03' => '1111'
+                  )
+
+                                );
+        $this->actual = $this->objAddress->getList($customer_id);
+        
+        $this->verify('配送先一覧取得');
+    }
+
+
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_registAddressTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_registAddressTest.php	(revision 22723)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_registAddressTest.php	(revision 22723)
@@ -0,0 +1,114 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Address_registAddressTest extends SC_Helper_Address_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objAddress = new SC_Helper_Address_Ex();
+    }
+
+    protected function tearUp()
+    {
+        parent::tearUp();
+    }
+
+    /////////////////////////////////////////
+
+//顧客idがない場合は直にExitしてしまうので未実行
+/*
+    public function testregistAddressTest_顧客idが無い場合_システムエラーを返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpAddress();
+        //$this->expected = "1";
+        $this->objAddress->registAddress(null);
+        $this->actual = '';
+        $this->verify('アドレス追加');
+    }
+*/
+
+
+    public function testregistAddressTest_会員の登録配送先を追加する()
+    {
+         if(DB_TYPE != 'pgsql') { //postgresqlだとどうしてもDBエラーになるのでとりいそぎ回避
+            $this->setUpAddress();
+            $arrSql =
+                array(
+                    'customer_id' => '1',
+                    'name01' => 'テスト',
+                    'name02' => 'よん',
+                    'kana01' => 'テスト',
+                    'kana02' => 'ヨン',
+                    'zip01' => '333',
+                    'zip02'=> '3333',
+                    'pref' => '4',
+                    'addr01' => 'テスト4',
+                    'addr02' => 'テスト4',
+                    'tel01' => '001',
+                    'tel02' => '0002',
+                    'tel03' => '0003',
+                    'fax01' => '112',
+                    'fax02' => '1113',
+                    'fax03' => '1114'
+                );
+            $objQuery =& SC_Query_Ex::getSingletonInstance();
+            $this->expected = '1002';
+            $this->objAddress->registAddress($arrSql);
+            $col = 'other_deliv_id';
+            $from = 'dtb_other_deliv';
+            $where = 'other_deliv_id = ?';
+            $arrWhere = array($this->expected);
+            $ret = $objQuery->select($col, $from, $where, $arrWhere);
+            $this->actual = $ret['other_deliv_id'];
+            $this->verify('アドレス追加');
+        }
+    }
+
+
+    public function testregistAddressTest_会員の登録配送先を更新する()
+    {
+        $this->setUpAddress();
+        $arrSql =
+            array(
+                'other_deliv_id' => '1000',
+                'customer_id' => '1',
+                'name01' => 'テスト',
+                'name02' => '更新',
+                'kana01' => 'テスト',
+                'kana02' => 'コウシン',
+                'zip01' => '222',
+                'zip02'=> '2222',
+                'pref' => '4',
+                'addr01' => 'テスト1',
+                'addr02' => 'テスト1',
+                'tel01' => '001',
+                'tel02' => '0002',
+                'tel03' => '0003',
+                'fax01' => '112',
+                'fax02' => '1113',
+                'fax03' => '1114'
+            );
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->objAddress->registAddress($arrSql);
+
+        $this->expected = $arrSql;
+        $col = '*';
+        $from = 'dtb_other_deliv';
+        $where = 'other_deliv_id = ?';
+        $arrWhere = array($arrSql['other_deliv_id']);
+        $this->actual = $objQuery->getRow($col, $from, $where, $arrWhere);
+        
+        $this->verify('登録配送先更新');
+    }
+
+
+
+
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php	(revision 22723)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php	(revision 22723)
@@ -0,0 +1,64 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Address_getAddressTest extends SC_Helper_Address_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objAddress = new SC_Helper_Address_Ex();
+    }
+
+    protected function tearUp()
+    {
+        parent::tearUp();
+    }
+
+    /////////////////////////////////////////
+
+
+    public function testgetAddressTest_会員の登録配送先が該当テーブルに存在しない場合_FALSEを返す()
+    {
+        $this->setUpAddress();
+        $other_deliv_id = '999';
+        $this->expected = FALSE;
+        $this->actual = $this->objAddress->getAddress($other_deliv_id);
+        
+        $this->verify('登録配送先取得');
+    }
+
+    public function testgetAddressTest_会員の登録配送先が該当テーブルに存在する場合_2を返す()
+    {
+        $this->setUpAddress();
+        $other_deliv_id = '1001';
+        $this->expected = array(
+                'other_deliv_id' => '1001',
+                'customer_id' => '1',
+                'name01' => 'テスト',
+                'name02' => 'に',
+                'kana01' => 'テスト',
+                'kana02' => 'ニ',
+                'zip01' => '222',
+                'zip02'=> '2222',
+                'pref' => '2',
+                'addr01' => 'テスト1',
+                'addr02' => 'テスト2',
+                'tel01' => '000',
+                'tel02' => '0000',
+                'tel03' => '0000',
+                'fax01' => '111',
+                'fax02' => '1111',
+                'fax03' => '1111'
+            );
+        $this->actual = $this->objAddress->getAddress($other_deliv_id);
+        
+        $this->verify('登録配送先取得');
+    }
+
+
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_deleteAddressTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_deleteAddressTest.php	(revision 22723)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Address/SC_Helper_Address_deleteAddressTest.php	(revision 22723)
@@ -0,0 +1,40 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Address_deleteAddressTest extends SC_Helper_Address_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objAddress = new SC_Helper_Address_Ex();
+    }
+
+    protected function tearUp()
+    {
+        parent::tearUp();
+    }
+
+    /////////////////////////////////////////
+
+    public function testdeleteAddressTest_会員の登録配送先を削除する()
+    {
+        $this->setUpAddress();
+        $other_deliv_id = '1000';
+        $this->expected = NULL;
+        $this->objAddress->deleteAddress($other_deliv_id);
+        $objQuery   =& SC_Query_Ex::getSingletonInstance();
+        $select = '*';
+        $from = 'dtb_other_deliv';
+        $where = 'other_deliv_id = ?';
+        $whereVal = array($other_deliv_id);
+        $this->actual = $objQuery->getRow($select, $from, $where, $whereVal);
+        
+        $this->verify('登録配送先削除');
+    }
+
+}
