Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/webpack-5.95.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess authored Oct 17, 2024
2 parents a5652e2 + fc7212d commit 5d5cc58
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
3 changes: 3 additions & 0 deletions data/class/helper/SC_Helper_Purchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,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'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -65,36 +65,52 @@ 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();
$arrProduct = $objProduct->getDetailAndProductsClass($this->productsClass['product_class_id']);
$this->expected = [
'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,
];
'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' => [
'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();
}

// ////////////////////////////////////////
}

0 comments on commit 5d5cc58

Please sign in to comment.