Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_deleteRankTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_deleteRankTest.php	(revision 22643)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_deleteRankTest.php	(revision 22643)
@@ -0,0 +1,43 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Kiyaku_deleteRankTest extends SC_Helper_Kiyaku_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objKiyaku = new SC_Helper_Kiyaku_Ex();
+    }
+
+    protected function tearUp()
+    {
+        parent::tearUp();
+    }
+
+    /////////////////////////////////////////
+
+    public function testdeleteRankTest_削除ができた場合_del_flgの1を返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpKiyaku();
+        $kiyaku_id = 2;
+
+        //期待値
+        $this->expected = "1";
+
+        $this->objKiyaku->deleteRank($kiyaku_id);
+
+        $col = 'del_flg';
+        $from = 'dtb_kiyaku';
+        $where = 'kiyaku_id = ?';
+        $whereVal = array($kiyaku_id);
+        $res = $objQuery->getCol($col, $from, $where, $whereVal);
+        $this->actual = $res[0];
+        $this->verify('ランク削除');
+    }
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankUpTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankUpTest.php	(revision 22643)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankUpTest.php	(revision 22643)
@@ -0,0 +1,43 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Kiyaku_rankUpTest extends SC_Helper_Kiyaku_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objKiyaku = new SC_Helper_Kiyaku_Ex();
+    }
+
+    protected function tearUp()
+    {
+        parent::tearUp();
+    }
+
+    /////////////////////////////////////////
+
+    public function testrankUpTest_ランクアップができた場合_ランクを返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpKiyaku();
+        $kiyaku_id = 2;
+
+        //期待値
+        $this->expected = '12';
+
+        $this->objKiyaku->rankUp($kiyaku_id);
+
+        $col = 'rank';
+        $from = 'dtb_kiyaku';
+        $where = 'kiyaku_id = ?';
+        $whereVal = array($kiyaku_id);
+        $res = $objQuery->getCol($col, $from, $where, $whereVal);
+        $this->actual = $res[0];
+        $this->verify('ランクアップ');
+    }
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankDownTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankDownTest.php	(revision 22643)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankDownTest.php	(revision 22643)
@@ -0,0 +1,43 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Kiyaku_rankDownTest extends SC_Helper_Kiyaku_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objKiyaku = new SC_Helper_Kiyaku_Ex();
+    }
+
+    protected function tearDown()
+    {
+        parent::tearDown();
+    }
+
+    /////////////////////////////////////////
+
+    public function testrankDownTest_ランクダウンができた場合_ランクを返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpKiyaku();
+        $kiyaku_id = 1;
+
+        //期待値
+        $this->expected = '11';
+
+        $this->objKiyaku->rankDown($kiyaku_id);
+
+        $col = 'rank';
+        $from = 'dtb_kiyaku';
+        $where = 'kiyaku_id = ?';
+        $whereVal = array($kiyaku_id);
+        $res = $objQuery->getCol($col, $from, $where, $whereVal);
+        $this->actual = $res[0];
+        $this->verify('ランクダウン');
+    }
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php	(revision 22643)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php	(revision 22643)
@@ -0,0 +1,66 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../../";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/**
+ *
+ */
+class SC_Helper_Kiyaku_TestBase extends Common_TestCase
+{
+    protected function setUp()
+    {
+        parent::setUp();
+    }
+
+    protected function tearDown()
+    {
+        parent::tearDown();
+    }
+
+    /**
+     * DBに規約情報を登録します.
+     */
+    protected function setUpKiyaku()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        // シーケンス初期化
+        
+        $kiyaku = array(
+            array(
+                'kiyaku_id' => '1',
+                'kiyaku_title' => 'test1',
+                'kiyaku_text' => 'test_text',
+                'rank' => '12',
+                'creator_id' => '0',
+                'create_date' => '2000-01-01 00:00:00',
+                'update_date' => '2000-01-01 00:00:00',
+                'del_flg' => '0'
+                  ),
+            array(
+                'kiyaku_id' => '2',
+                'kiyaku_title' => 'test2',
+                'kiyaku_text' => 'test_text2',
+                'rank' => '11',
+                'creator_id' => '0',
+                'create_date' => '2000-01-01 00:00:00',
+                'update_date' => '2000-01-01 00:00:00',
+                'del_flg' => '0'
+                  ),
+            array(
+                'kiyaku_id' => '3',
+                'kiyaku_title' => 'test3',
+                'kiyaku_text' => 'test_text',
+                'rank' => '10',
+                'creator_id' => '0',
+                'create_date' => '2000-01-01 00:00:00',
+                'update_date' => '2000-01-01 00:00:00',
+                'del_flg' => '1'
+                  )
+                                );
+
+        $this->objQuery->delete('dtb_kiyaku');
+        foreach ($kiyaku as $key => $item) {
+            $ret = $objQuery->insert('dtb_kiyaku', $item);
+        }
+    }
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_isTitleExistTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_isTitleExistTest.php	(revision 22643)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_isTitleExistTest.php	(revision 22643)
@@ -0,0 +1,74 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Kiyaku_isTitleExistTest extends SC_Helper_Kiyaku_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objKiyaku = new SC_Helper_Kiyaku_Ex();
+    }
+
+    protected function tearDown()
+    {
+        parent::tearDown();
+    }
+
+    /////////////////////////////////////////
+
+    public function testisTitleExistTest_タイトルが重複しているものがある場合_trueを返す()
+    {
+        $this->setUpKiyaku();
+        $title =  'test1';
+        $kiyaku_id = 2;
+
+        $this->expected = true;
+
+        $this->actual = $this->objKiyaku->isTitleExist($title, $kiyaku_id);
+
+        $this->verify('規約タイトル重複');
+    }
+
+    public function testisTitleExistTest_新規登録でタイトルが重複しているものがある場合_trueを返す()
+    {
+        $this->setUpKiyaku();
+        $title =  'test1';
+
+        $this->expected = true;
+
+        $this->actual = $this->objKiyaku->isTitleExist($title);
+
+        $this->verify('規約タイトル重複');
+    }
+
+    public function testisTitleExistTest_タイトルが重複していない場合_falseを返す()
+    {
+        $this->setUpKiyaku();
+        $title =  'xxxx';
+        $kiyaku_id = 2;
+
+        $this->expected = false;
+
+        $this->actual = $this->objKiyaku->isTitleExist($title, $kiyaku_id);
+
+        $this->verify('規約タイトル重複');
+    }
+
+    public function testisTitleExistTest_新規登録でタイトルが重複していない場合_falseを返す()
+    {
+        $this->setUpKiyaku();
+        $title =  'xxx';
+
+        $this->expected = false;
+
+        $this->actual = $this->objKiyaku->isTitleExist($title);
+
+        $this->verify('規約タイトル重複');
+    }
+
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_saveRankTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_saveRankTest.php	(revision 22643)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_saveRankTest.php	(revision 22643)
@@ -0,0 +1,65 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Kiyaku_saveRankTest extends SC_Helper_Kiyaku_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objKiyaku = new SC_Helper_Kiyaku_Ex();
+    }
+
+    protected function tearDown()
+    {
+        parent::tearDown();
+    }
+
+    /////////////////////////////////////////
+
+    public function testsaveRankTest_新規で規約を登録する場合_3を返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpKiyaku();
+                $sqlval = array(
+                'kiyaku_title' => '第3条 (TEST)',
+                'kiyaku_text' => 'testKiyaku',
+                'rank' => '',
+                'creator_id' => '0',
+                'create_date' => '2000-01-01 00:00:00',
+                'update_date' => '2000-01-01 00:00:00',
+                'del_flg' => '0'
+                                );
+        $this->expected = 4;
+        // シーケンス調整
+        $sqlval['kiyaku_id'] = $objQuery->setVal('dtb_kiyaku_kiyaku_id', 4);
+        $this->actual = $this->objKiyaku->saveRank($sqlval);
+
+        $this->verify('新規規約登録');
+    }
+
+    public function testsaveRankTest_規約を更新する場合_2を返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpKiyaku();
+                $sqlval = array(
+                'kiyaku_id' => '2',
+                'kiyaku_title' => '第2条 (登録)',
+                'kiyaku_text' => 'test kiyaku2',
+                'rank' => '11',
+                'creator_id' => '0',
+                'create_date' => '2000-01-01 00:00:00',
+                'update_date' => '2000-01-01 00:00:00',
+                'del_flg' => '0'
+                                );
+        $this->expected = 2;
+        // シーケンス調整
+        $this->actual = $this->objKiyaku->saveRank($sqlval);
+
+        $this->verify('新規規約登録');
+    }
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php	(revision 22643)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php	(revision 22643)
@@ -0,0 +1,75 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Kiyaku_getListTest extends SC_Helper_Kiyaku_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objKiyaku = new SC_Helper_Kiyaku_Ex();
+    }
+
+    protected function tearUp()
+    {
+        parent::tearUp();
+    }
+
+    /////////////////////////////////////////
+
+    public function testgetListTest_削除した商品も含んだ一覧を取得できた場合_一覧のarrayを返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpKiyaku();
+        $has_deleted = TRUE;
+        //期待値
+        $this->expected = array(
+            array(
+                'kiyaku_id' => '1',
+                'kiyaku_title' => 'test1',
+                'kiyaku_text' => 'test_text'
+                  ),
+            array(
+                'kiyaku_id' => '2',
+                'kiyaku_title' => 'test2',
+                'kiyaku_text' => 'test_text2'
+                  ),
+            array(
+                'kiyaku_id' => '3',
+                'kiyaku_title' => 'test3',
+                'kiyaku_text' => 'test_text'
+                  )
+                                );
+
+        $this->actual = $this->objKiyaku->getList($has_deleted);
+        $this->verify('規約一覧取得');
+    }
+
+    public function testgetListTest_一覧を取得できた場合削除した商品は取得しない_一覧のarrayを返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpKiyaku();
+        $has_deleted = FALSE;
+        //期待値
+        $this->expected = array(
+            array(
+                'kiyaku_id' => '1',
+                'kiyaku_title' => 'test1',
+                'kiyaku_text' => 'test_text'
+                  ),
+            array(
+                'kiyaku_id' => '2',
+                'kiyaku_title' => 'test2',
+                'kiyaku_text' => 'test_text2'
+                  ),
+                                );
+
+        $this->actual = $this->objKiyaku->getList($has_deleted);
+        $this->verify('規約一覧取得');
+    }
+
+}
Index: /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getRankTest.php
===================================================================
--- /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getRankTest.php	(revision 22643)
+++ /branches/camp/camp-2_13-tests/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getRankTest.php	(revision 22643)
@@ -0,0 +1,86 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../../..";
+require_once($HOME . "/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php");
+/**
+ *
+ */
+class SC_Helper_Kiyaku_getRankTest extends SC_Helper_Kiyaku_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objKiyaku = new SC_Helper_Kiyaku_Ex();
+    }
+
+    protected function tearUp()
+    {
+        parent::tearUp();
+    }
+
+    /////////////////////////////////////////
+
+    public function testgetRankTest_規約情報を取得できた場合_規約のarrayを返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpKiyaku();
+        $has_deleted = FALSE;
+        $kiyaku_id = 1;
+        //期待値
+        $this->expected = array(
+            'kiyaku_id' => '1',
+            'kiyaku_title' => 'test1',
+            'kiyaku_text' => 'test_text',
+            'rank' => '12',
+            'creator_id' => '0',
+            'create_date' => '2000-01-01 00:00:00',
+            'update_date' => '2000-01-01 00:00:00',
+            'del_flg' => '0'
+                                );
+
+        $this->actual = $this->objKiyaku->getRank($kiyaku_id, $has_deleted);
+        $this->verify('規約詳細取得');
+    }
+
+    public function testgetRankTest_規約情報を規約idから取得する際削除された規約を指定した場合_nullを返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpKiyaku();
+        $has_deleted = FALSE;
+        $kiyaku_id = 3;
+        //期待値
+        $this->expected = null;
+
+        $this->actual = $this->objKiyaku->getRank($kiyaku_id, $has_deleted);
+        $this->verify('規約詳細取得');
+    }
+
+    public function testgetRankTest_削除された情報を含む規約情報を規約idから取得する際削除された規約を指定した場合_nullを返す()
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $this->setUpKiyaku();
+        $has_deleted = TRUE;
+        $kiyaku_id = 3;
+        //期待値
+        $this->expected = array(
+                'kiyaku_id' => '3',
+                'kiyaku_title' => 'test3',
+                'kiyaku_text' => 'test_text',
+                'rank' => '10',
+                'creator_id' => '0',
+                'create_date' => '2000-01-01 00:00:00',
+                'update_date' => '2000-01-01 00:00:00',
+                'del_flg' => '1'
+                                );
+
+        $this->actual = $this->objKiyaku->getRank($kiyaku_id, $has_deleted);
+        $this->verify('規約詳細取得');
+    }
+
+
+
+
+
+
+}
