Index: branches/version-2_13-dev/tests/class/SC_CartSession/SC_CartSession_getCartListTest.php
===================================================================
--- branches/version-2_13-dev/tests/class/SC_CartSession/SC_CartSession_getCartListTest.php	(revision 23398)
+++ branches/version-2_13-dev/tests/class/SC_CartSession/SC_CartSession_getCartListTest.php	(revision 23398)
@@ -0,0 +1,230 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../..";
+require_once($HOME . "/tests/class/SC_CartSession/SC_CartSession_TestBase.php");
+
+/**
+ * SC_CartSession_getCartListTest
+ *
+ * @package
+ * @version $id$
+ * @copyright
+ * @author Nobuhiko Kimoto <info@nob-log.info>
+ * @license
+ */
+class SC_CartSession_getCartListTest extends SC_CartSession_TestBase
+{
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->objCartSession = new SC_CartSession_Ex();
+    }
+
+    protected function tearDown()
+    {
+        parent::tearDown();
+    }
+
+    /////////////////////////////////////////
+
+    /**
+     * @test
+     */
+    public function getCartList_商品を追加していなければ空の配列を返す()
+    {
+        $this->setUpProductClass();
+        //$this->setUpProducts();
+        //$this->setUpClassCategory();
+
+        $this->expected = 0;
+
+        $this->actual = count($this->objCartSession->getCartList(1));
+
+        $this->verify('商品数');
+    }
+
+    /**
+     * @test
+     */
+    public function getCartList_商品を1つ追加した場合1つの配列を返す()
+    {
+        $this->setUpProductClass();
+        //$this->setUpProducts();
+        //$this->setUpClassCategory();
+
+        $this->expected = 1;
+        $this->objCartSession->addProduct('1001', 1);
+
+        $cartList = $this->objCartSession->getCartList(1);
+        $this->actual = count($cartList);
+
+        $this->verify('商品数');
+
+        return $cartList;
+    }
+
+    /**
+     * @test
+     * @depends getCartList_商品を1つ追加した場合1つの配列を返す
+     */
+    public function getCartList_商品を1つ追加した場合合計数は1($cartList)
+    {
+        $this->expected = 1;
+        $this->actual = $cartList[0]['quantity'];
+        $this->verify('商品追加数');
+    }
+
+    /**
+     * @test
+     * @depends getCartList_商品を1つ追加した場合1つの配列を返す
+     */
+    public function getCartList_商品を1つ追加した場合商品データを返す($cartList)
+    {
+        $this->expected = array(
+            'product_id' => '1001'
+            ,'product_code_min' => 'code1001'
+            ,'product_code_max' => 'code1001'
+            ,'name' => '製品名1001'
+            ,'comment1' => 'コメント10011'
+            ,'comment2' => 'コメント10012'
+            ,'comment3' => 'コメント10013'
+            ,'main_list_comment' => 'リストコメント1001'
+            ,'main_image' => '1001.jpg'
+            ,'main_list_image' => '1001-main.jpg'
+            ,'price01_min' => '1500'
+            ,'price01_max' => '1500'
+            ,'price02_min' => '1500'
+            ,'price02_max' => '1500'
+            ,'stock_min' => '99'
+            ,'stock_max' => '99'
+            ,'stock_unlimited_min' => '0'
+            ,'stock_unlimited_max' => '0'
+            ,'deliv_date_id' => '1'
+            ,'status' => '1'
+            ,'del_flg' => '0'
+            ,'price01_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax('1500')
+            ,'price01_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax('1500')
+            ,'price02_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax('1500')
+            ,'price02_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax('1500')
+            ,'maker_id' => null
+            ,'comment4' => null
+            ,'comment5' => null
+            ,'comment6' => null
+            ,'note' => null
+            ,'main_comment' => 'メインコメント1001'
+            ,'main_large_image' => null
+            ,'sub_title1' => null
+            ,'sub_comment1' => null
+            ,'sub_image1' => null
+            ,'sub_large_image1' => null
+            ,'sub_title2' => null
+            ,'sub_comment2' => null
+            ,'sub_image2' => null
+            ,'sub_large_image2' => null
+            ,'sub_title3' => null
+            ,'sub_comment3' => null
+            ,'sub_image3' => null
+            ,'sub_large_image3' => null
+            ,'sub_title4' => null
+            ,'sub_comment4' => null
+            ,'sub_image4' => null
+            ,'sub_large_image4' => null
+            ,'sub_title5' => null
+            ,'sub_comment5' => null
+            ,'sub_image5' => null
+            ,'sub_large_image5' => null
+            ,'sub_title6' => null
+            ,'sub_comment6' => null
+            ,'sub_image6' => null
+            ,'sub_large_image6' => null
+            ,'creator_id' => '1'
+            ,'point_rate' => '0'
+            ,'deliv_fee' => null
+            ,'class_count' => '1'
+            ,'maker_name' => null
+            ,'stock' => '99'
+            ,'stock_unlimited' => '0'
+            ,'sale_limit' => null
+            ,'price01' => '1500'
+            ,'price02' => '1500'
+            ,'product_code' => 'code1001'
+            ,'product_class_id' => '1001'
+            ,'product_type_id' => '1'
+            ,'down_filename' => null
+            ,'down_realfilename' => null
+            ,'classcategory_name1' => 'cat1001'
+            ,'rank1' => null
+            ,'class_name1' => '味'
+            ,'class_id1' => '1'
+            ,'classcategory_id1' => '1001'
+            ,'classcategory_id2' => '1002'
+            ,'classcategory_name2' => 'cat1002'
+            ,'rank2' => null
+            ,'class_name2' => '味'
+            ,'class_id2' => '1'
+            ,'price01_inctax' => 1575.0
+            ,'price02_inctax' => 1575.0
+            //,'create_date' => '2014-05-04 12:20:29'
+            //,'update_date' => '2014-05-04 12:20:29'
+        );
+
+        // 時間はずれるので配列から削除
+        unset($cartList[0]['productsClass']['update_date']);
+        unset($cartList[0]['productsClass']['create_date']);
+
+        $this->actual = $cartList[0]['productsClass'];
+        $this->verify('商品詳細');
+    }
+
+
+    /**
+     * @test
+     */
+    public function getCartList_削除済み商品を追加した場合はカートは空()
+    {
+        $this->setUpProductClass();
+        //$this->setUpProducts();
+        //$this->setUpClassCategory();
+
+        $this->expected = 0;
+        $this->objCartSession->addProduct('2001', 1);
+
+        $cartList = $this->objCartSession->getCartList(1);
+        $this->actual = count($cartList);
+        $this->verify('商品数');
+    }
+
+    /**
+     * @test
+     */
+    /* バグな気がする？
+    public function getCartList_非表示商品を追加した場合はカートは空()
+    {
+        $this->setUpProductClass();
+        $this->setUpProducts();
+        $this->setUpClassCategory();
+
+        $this->expected = 0;
+        $this->objCartSession->addProduct('1002', 1);
+        $cartList = $this->objCartSession->getCartList(2);
+        $this->actual = count($cartList);
+        $this->verify('商品数');
+    }*/
+
+    /**
+     * @test
+     */
+    public function getCartList_複数商品種別の30商品を追加した場合カートに30商品追加されている()
+    {
+        $this->setUpBigProductClass();
+        $this->expected = 30;
+        for ($i = 3000; $i < 3030; $i++) {
+            $this->objCartSession->addProduct($i, 1);
+        }
+        $cartList = count($this->objCartSession->getCartList(1)) + count($this->objCartSession->getCartList(2)) + count($this->objCartSession->getCartList(3));
+        $this->actual = $cartList;
+
+        $this->verify('商品数');
+    }
+}
Index: branches/version-2_13-dev/tests/class/SC_CartSession/SC_CartSession_TestBase.php
===================================================================
--- branches/version-2_13-dev/tests/class/SC_CartSession/SC_CartSession_TestBase.php	(revision 23398)
+++ branches/version-2_13-dev/tests/class/SC_CartSession/SC_CartSession_TestBase.php	(revision 23398)
@@ -0,0 +1,287 @@
+<?php
+
+$HOME = realpath(dirname(__FILE__)) . "/../../..";
+require_once($HOME . "/tests/class/Common_TestCase.php");
+/**
+ *
+ */
+class SC_CartSession_TestBase extends Common_TestCase
+{
+    protected function setUp()
+    {
+        parent::setUp();
+    }
+
+    protected function tearDown()
+    {
+        parent::tearDown();
+    }
+
+    /**
+     * DBに商品クラス情報を設定します.
+     */
+    protected function setUpProductClass()
+    {
+        $product_class = array(
+            array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_class_id' => '1001',
+                'product_id' => '1001',
+                'product_type_id' => '1',
+                'product_code' => 'code1001',
+                'classcategory_id1' => '1001',
+                'classcategory_id2' => '1002',
+                'price01' => '1500',
+                'price02' => '1500',
+                'stock' => '99',
+                'creator_id' => '1',
+                'del_flg' => '0'
+            ),
+            array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_class_id' => '1002',
+                'product_id' => '1002',
+                'product_type_id' => '2',
+                'product_code' => 'code1002',
+                'price02' => '2500',
+                'creator_id' => '1',
+                'stock_unlimited' => '1',
+                'del_flg' => '0'
+            ),
+            array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_class_id' => '2001',
+                'product_id' => '2001',
+                'product_type_id' => '1',
+                'product_code' => 'code2001',
+                'price02' => '2000',
+                'creator_id' => '1',
+                'stock_unlimited' => '1',
+                'del_flg' => '1'
+            )
+        );
+
+        $this->objQuery->delete('dtb_products_class');
+        foreach ($product_class as $key => $item) {
+            $this->objQuery->insert('dtb_products_class', $item);
+        }
+
+        // 1000商品一気に投入
+        for ($i = 3000; $i < 3100; $i++) {
+            $item = array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_class_id' => $i,
+                'product_id' => $i,
+                'product_type_id' => '1',
+                'product_code' => 'code'.$i,
+                'classcategory_id1' => '1001',
+                'classcategory_id2' => '1002',
+                'price01' => $i,
+                'price02' => $i,
+                'stock' => '99',
+                'creator_id' => '1',
+                'del_flg' => '0'
+            );
+            $this->objQuery->insert('dtb_products_class', $item);
+        }
+
+        $this->setUpClassCategory();
+        $this->setUpProducts();
+    }
+
+    /**
+     * DBに製品カテゴリ情報を登録します.
+     */
+    protected function setUpClassCategory()
+    {
+        $class_category = array(
+            array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'classcategory_id' => '1001',
+                'class_id' => '1',
+                'creator_id' => '1',
+                'name' => 'cat1001'
+            ),
+            array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'classcategory_id' => '1002',
+                'class_id' => '1',
+                'creator_id' => '1',
+                'name' => 'cat1002'
+            )
+        );
+
+        $this->objQuery->delete('dtb_classcategory');
+        foreach ($class_category as $key => $item) {
+            $this->objQuery->insert('dtb_classcategory', $item);
+        }
+    }
+
+    /**
+     * DBに製品情報を登録します.
+     */
+    protected function setUpProducts()
+    {
+        $products = array(
+            array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_id' => '1001',
+                'name' => '製品名1001',
+                'comment1' => 'コメント10011',
+                'comment2' => 'コメント10012',
+                'comment3' => 'コメント10013',
+                'main_list_comment' => 'リストコメント1001',
+                'main_comment' => 'メインコメント1001',
+                'main_image' => '1001.jpg',
+                'main_list_image' => '1001-main.jpg',
+                'deliv_date_id' => '1',
+                'del_flg' => '0',
+                'creator_id' => '1',
+                'status' => '1'
+            ),
+            array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_id' => '1002',
+                'name' => '製品名1002',
+                'comment1' => 'コメント10021',
+                'comment2' => 'コメント10022',
+                'comment3' => 'コメント10023',
+                'main_list_comment' => 'リストコメント1002',
+                'main_image' => '1002.jpg',
+                'main_list_image' => '1002-main.jpg',
+                'deliv_date_id' => '2',
+                'del_flg' => '0',
+                'creator_id' => '1',
+                'status' => '2'
+            ),
+            array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_id' => '2001',
+                'name' => '製品名2001',
+                'comment1' => 'コメント20011',
+                'comment2' => 'コメント20012',
+                'comment3' => 'コメント20013',
+                'main_list_comment' => 'リストコメント2001',
+                'main_comment' => 'メインコメント2001',
+                'main_image' => '2001.jpg',
+                'main_list_image' => '2001-main.jpg',
+                'deliv_date_id' => '1',
+                'del_flg' => '1',
+                'creator_id' => '1',
+                'status' => '1'
+            )
+        );
+
+        $this->objQuery->delete('dtb_products');
+        foreach ($products as $key => $item) {
+            $this->objQuery->insert('dtb_products', $item);
+        }
+
+        // 100商品一気に投入
+        for ($i = 3000; $i < 4000; $i++) {
+            $item = array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_id' => $i,
+                'name' => '製品名'.$i,
+                'comment1' => 'コメント'.$i,
+                'comment2' => 'コメント'.$i,
+                'comment3' => 'コメント'.$i,
+                'main_list_comment' => 'リストコメント'.$i,
+                'main_comment' => 'メインコメント'.$i,
+                'main_image' => $i.'.jpg',
+                'main_list_image' => $i.'-main.jpg',
+                'deliv_date_id' => '1',
+                'del_flg' => '0',
+                'creator_id' => '1',
+                'status' => '1'
+            );
+            $this->objQuery->insert('dtb_products', $item);
+        }
+    }
+
+    /**
+     * DBに商品ステータス情報を登録します.
+     */
+    protected function setUpProductStatus()
+    {
+        $class_category = array(
+            array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_status_id' => '1',
+                'product_id' => '1001',
+                'creator_id' => '1',
+                'del_flg' => '0'
+            ),
+            array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_status_id' => '1',
+                'product_id' => '1002',
+                'creator_id' => '1',
+                'del_flg' => '0'
+            )
+        );
+
+        $this->objQuery->delete('dtb_product_status');
+        foreach ($class_category as $key => $item) {
+            $this->objQuery->insert('dtb_product_status', $item);
+        }
+    }
+
+
+    /**
+     * DBに商品クラス情報を大量に設定します.
+     */
+    protected function setUpBigProductClass()
+    {
+        $this->objQuery->delete('dtb_products_class');
+        // 商品を一気に投入
+        for ($i = 3000; $i < 3030; $i++) {
+            $item = array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_class_id' => $i,
+                'product_id' => $i,
+                'product_type_id' => $i%3+1,
+                'product_code' => 'code'.$i,
+                'classcategory_id1' => '1001',
+                'classcategory_id2' => '1002',
+                'price01' => $i,
+                'price02' => $i,
+                'stock' => '99',
+                'creator_id' => '1',
+                'del_flg' => '0'
+            );
+            $this->objQuery->insert('dtb_products_class', $item);
+        }
+
+        $this->setUpClassCategory();
+        $this->setUpBigProducts();
+    }
+
+    /**
+     * DBに製品情報を大量に登録します.
+     */
+    protected function setUpBigProducts()
+    {
+        $this->objQuery->delete('dtb_products');
+        // 商品一気に投入
+        for ($i = 3000; $i < 3030; $i++) {
+            $item = array(
+                'update_date' => 'CURRENT_TIMESTAMP',
+                'product_id' => $i,
+                'name' => '製品名'.$i,
+                'comment1' => 'コメント'.$i,
+                'comment2' => 'コメント'.$i,
+                'comment3' => 'コメント'.$i,
+                'main_list_comment' => 'リストコメント'.$i,
+                'main_comment' => 'メインコメント'.$i,
+                'main_image' => $i.'.jpg',
+                'main_list_image' => $i.'-main.jpg',
+                'deliv_date_id' => '1',
+                'del_flg' => '0',
+                'creator_id' => '1',
+                'status' => '1'
+            );
+            $this->objQuery->insert('dtb_products', $item);
+        }
+    }
+}
