From ce041e5262410d86738f450d71e93e27c34fceaf Mon Sep 17 00:00:00 2001 From: clicktx Date: Thu, 3 Oct 2024 17:08:27 +0900 Subject: [PATCH 1/3] =?UTF-8?q?productsClass=E3=82=92unset=E3=81=97?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=83=86=E3=82=B9=E3=83=88=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...elper_Purchase_setShipmentItemTempTest.php | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php index 743964bf71..648379680e 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php @@ -76,20 +76,38 @@ public function testSetShipmentItemTemp_製品情報が既に存在する場合_ $this->verify(); } - public function testSetShipmentItemTemp_製品情報が存在しない場合_DBから取得した値が反映される() + public function testSetShipmentItemTemp_製品情報が存在しない場合_DBから取得した値が反映され_不要な情報は削除される() { $quantity = 10; $this->helper->setShipmentItemTemp('1001', $this->productsClass['product_class_id'], $quantity); + $objProduct = new SC_Product_Ex; + $arrProduct = $objProduct->getDetailAndProductsClass($this->productsClass['product_class_id']); $this->expected = array( 'shipping_id' => '1001', 'product_class_id' => $this->productsClass['product_class_id'], 'quantity' => $quantity, 'price' => $this->productsClass['price02'], 'total_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax($this->productsClass['price02']) * $quantity, + 'productsClass' => array( + 'product_id' => $arrProduct['product_id'], + 'product_class_id' => $arrProduct['product_class_id'], + 'name' => $arrProduct['name'], + 'price02' => $arrProduct['price02'], + 'point_rate' => $arrProduct['point_rate'], + 'main_list_image' => $arrProduct['main_list_image'], + 'main_image' => $arrProduct['main_image'], + 'product_code' => $arrProduct['product_code'], + 'stock' => $arrProduct['stock'], + 'stock_unlimited' => $arrProduct['stock_unlimited'], + 'sale_limit' => $arrProduct['sale_limit'], + 'class_name1' => $arrProduct['class_name1'], + 'classcategory_name1' => $arrProduct['classcategory_name1'], + 'class_name2' => $arrProduct['class_name2'], + 'classcategory_name2' => $arrProduct['classcategory_name2'], + ), ); $result = $_SESSION['shipping']['1001']['shipment_item'][$this->productsClass['product_class_id']]; - unset($result['productsClass']); $this->actual = $result; $this->verify(); @@ -97,4 +115,3 @@ public function testSetShipmentItemTemp_製品情報が存在しない場合_DB ////////////////////////////////////////// } - From b2cfa7bea8a2eff08a9419440f1462dde26a0973 Mon Sep 17 00:00:00 2001 From: clicktx Date: Thu, 3 Oct 2024 17:09:53 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix=20#1007=20=E3=82=BB=E3=83=83=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=81=AB=E4=BF=9D=E5=AD=98=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E9=85=8D=E9=80=81=E5=95=86=E5=93=81=E8=A9=B3=E7=B4=B0?= =?UTF-8?q?=E3=81=8B=E3=82=89=E4=B8=8D=E8=A6=81=E3=81=AA=E3=82=82=E3=81=AE?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/class/helper/SC_Helper_Purchase.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/class/helper/SC_Helper_Purchase.php b/data/class/helper/SC_Helper_Purchase.php index 3f58a5221b..3e67f36c53 100644 --- a/data/class/helper/SC_Helper_Purchase.php +++ b/data/class/helper/SC_Helper_Purchase.php @@ -387,6 +387,9 @@ public function setShipmentItemTemp($shipping_id, $product_class_id, $quantity) if (empty($arrItems['productsClass'])) { $product = &$objProduct->getDetailAndProductsClass($product_class_id); + // セッション変数のデータ量を抑制するため、一部の商品情報を切り捨てる + $objCartSession = new SC_CartSession_Ex(); + $objCartSession->adjustSessionProductsClass($product); $arrItems['productsClass'] = $product; } $arrItems['price'] = $arrItems['productsClass']['price02']; From dcf37710286e48eafbec10f9c98a0d0b158dad79 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Thu, 17 Oct 2024 00:28:38 +0900 Subject: [PATCH 3/3] Apply PHP_CS_FIXER_IGNORE_ENV=1 data/vendor/bin/php-cs-fixer fix --allow-risky=yes --- ...elper_Purchase_setShipmentItemTempTest.php | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php index fcb65f53d9..2bccb14dc0 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempTest.php @@ -49,8 +49,8 @@ protected function setUp(): void $this->productsClass = $this->objQuery->getRow('*', 'dtb_products_class', 'product_id = ?', [$this->product_id]); $_SESSION['shipping']['1001']['shipment_item'] = [ - '1001' => ['productsClass' => ['price02' => 9000]], - ]; + '1001' => ['productsClass' => ['price02' => 9000]], + ]; $this->helper = new SC_Helper_Purchase_Ex(); } @@ -65,24 +65,24 @@ public function testSetShipmentItemTemp製品情報が既に存在する場合 $this->helper->setShipmentItemTemp('1001', '1001', 10); $this->expected = [ - 'shipping_id' => '1001', - 'product_class_id' => '1001', - 'quantity' => 10, - 'price' => 9000, - 'total_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(90000), - 'productsClass' => ['price02' => 9000], - ]; + 'shipping_id' => '1001', + 'product_class_id' => '1001', + 'quantity' => 10, + 'price' => 9000, + 'total_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(90000), + 'productsClass' => ['price02' => 9000], + ]; $this->actual = $_SESSION['shipping']['1001']['shipment_item']['1001']; $this->verify(); } - public function testSetShipmentItemTemp_製品情報が存在しない場合_DBから取得した値が反映され_不要な情報は削除される() + public function testSetShipmentItemTemp製品情報が存在しない場合DBから取得した値が反映され不要な情報は削除される() { $quantity = 10; $this->helper->setShipmentItemTemp('1001', $this->productsClass['product_class_id'], $quantity); - - $objProduct = new SC_Product_Ex; + + $objProduct = new SC_Product_Ex(); $arrProduct = $objProduct->getDetailAndProductsClass($this->productsClass['product_class_id']); $this->expected = [ 'shipping_id' => '1001', @@ -91,26 +91,26 @@ public function testSetShipmentItemTemp_製品情報が存在しない場合_DB 'price' => $this->productsClass['price02'], 'total_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax($this->productsClass['price02']) * $quantity, 'productsClass' => [ - 'product_id' => $arrProduct['product_id'], - 'product_class_id' => $arrProduct['product_class_id'], - 'name' => $arrProduct['name'], - 'price02' => $arrProduct['price02'], - 'point_rate' => $arrProduct['point_rate'], - 'main_list_image' => $arrProduct['main_list_image'], - 'main_image' => $arrProduct['main_image'], - 'product_code' => $arrProduct['product_code'], - 'stock' => $arrProduct['stock'], - 'stock_unlimited' => $arrProduct['stock_unlimited'], - 'sale_limit' => $arrProduct['sale_limit'], - 'class_name1' => $arrProduct['class_name1'], + 'product_id' => $arrProduct['product_id'], + 'product_class_id' => $arrProduct['product_class_id'], + 'name' => $arrProduct['name'], + 'price02' => $arrProduct['price02'], + 'point_rate' => $arrProduct['point_rate'], + 'main_list_image' => $arrProduct['main_list_image'], + 'main_image' => $arrProduct['main_image'], + 'product_code' => $arrProduct['product_code'], + 'stock' => $arrProduct['stock'], + 'stock_unlimited' => $arrProduct['stock_unlimited'], + 'sale_limit' => $arrProduct['sale_limit'], + 'class_name1' => $arrProduct['class_name1'], 'classcategory_name1' => $arrProduct['classcategory_name1'], - 'class_name2' => $arrProduct['class_name2'], + 'class_name2' => $arrProduct['class_name2'], 'classcategory_name2' => $arrProduct['classcategory_name2'], ], - ; - $result = $_SESSION['shipping']['1001']['shipment_item'][$this->productsClass['product_class_id']]; - $this->actual = $result; - $this->verify(); + ]; + $result = $_SESSION['shipping']['1001']['shipment_item'][$this->productsClass['product_class_id']]; + $this->actual = $result; + $this->verify(); } // //////////////////////////////////////// }