From 7155a6ed16e271d28caecd2a47451145d10b7393 Mon Sep 17 00:00:00 2001 From: Daisuke Takeuji <8424850+takeuji@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:55:07 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=89=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Eccube/Tests/Entity/OrderTest.php | 52 +++++++++++-------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/tests/Eccube/Tests/Entity/OrderTest.php b/tests/Eccube/Tests/Entity/OrderTest.php index 1fcccd91bd2..35c63dd5aef 100644 --- a/tests/Eccube/Tests/Entity/OrderTest.php +++ b/tests/Eccube/Tests/Entity/OrderTest.php @@ -250,27 +250,6 @@ public function testGetTaxByTaxRate() } protected function createTestOrder() - { - $data = $this->getOrderItemData(); - $Order = new Order(); - foreach ($data as $row) { - $OrderItem = new OrderItem(); - $OrderItem->setTaxType($row[0]); - $OrderItem->setTaxRate($row[1]); - $OrderItem->setPrice($row[2]); - $OrderItem->setTax($row[3]); - $OrderItem->setQuantity($row[4]); - $OrderItem->setOrderItemType($row[5]); - $OrderItem->setTaxDisplayType($row[6]); - $OrderItem->setRoundingType($row[7]); - - $Order->addOrderItem($OrderItem); - } - - return $Order; - } - - protected function getOrderItemData() { $Taxation = $this->entityManager->find(TaxType::class, TaxType::TAXATION); $NonTaxable = $this->entityManager->find(TaxType::class, TaxType::NON_TAXABLE); @@ -288,17 +267,32 @@ protected function getOrderItemData() // 税率ごとに金額を集計する $data = [ - [$Taxation, 10, 71141, round(71141 * (10 / 100)), 5, $ProductItem, $TaxExcluded, $RoundingType], // 商品明細 - [$Taxation, 10, 92778, round(92778 * (10 / 100)), 4, $ProductItem, $TaxExcluded, $RoundingType], // 商品明細 - [$Taxation, 8, 15221, round(15221 * (8 / 100)), 5, $ProductItem, $TaxExcluded, $RoundingType], // 商品明細 - [$Taxation, 10, -71141, round(-71141 * (10 / 100)), 1, $DiscountItem, $TaxExcluded, $RoundingType], // 課税値引き - [$Taxation, 8, -15221, round(-15221 * (8 / 100)), 1, $DiscountItem, $TaxExcluded, $RoundingType], // 課税値引き - [$Taxation, 10, 1000, round(1000 * (10 / 100)), 1, $DeliveryFee, $TaxIncluded, $RoundingType], // 送料 - [$Taxation, 10, 2187, round(1000 * (10 / 100)), 1, $Charge, $TaxIncluded, $RoundingType], // 手数料 + [$Taxation, 10, 71141, round(71141 * (10/100)), 5, $ProductItem, $TaxExcluded, $RoundingType], // 商品明細 + [$Taxation, 10, 92778, round(92778 * (10/100)), 4, $ProductItem, $TaxExcluded, $RoundingType], // 商品明細 + [$Taxation, 8, 15221, round(15221 * (8/100)), 5, $ProductItem, $TaxExcluded, $RoundingType], // 商品明細 + [$Taxation, 10, -71141, round(-71141 * (10/100)), 1, $DiscountItem, $TaxExcluded, $RoundingType], // 課税値引き + [$Taxation, 8, -15221, round(-15221 * (8/100)), 1, $DiscountItem, $TaxExcluded, $RoundingType], // 課税値引き + [$Taxation, 10, 1000, round(1000 * (10/100)), 1, $DeliveryFee, $TaxIncluded, $RoundingType], // 送料 + [$Taxation, 10, 2187, round(1000 * (10/100)), 1, $Charge, $TaxIncluded, $RoundingType], // 手数料 [$NonTaxable, 0, -7000, 0, 1, $DiscountItem, $TaxIncluded, $RoundingType], // 不課税明細 [$TaxExempt, 0, -159, 0, 1, $DiscountItem, $TaxIncluded, $RoundingType], // 非課税明細 ]; - return $data; + $Order = new Order(); + foreach ($data as $row) { + $OrderItem = new OrderItem(); + $OrderItem->setTaxType($row[0]); + $OrderItem->setTaxRate($row[1]); + $OrderItem->setPrice($row[2]); + $OrderItem->setTax($row[3]); + $OrderItem->setQuantity($row[4]); + $OrderItem->setOrderItemType($row[5]); + $OrderItem->setTaxDisplayType($row[6]); + $OrderItem->setRoundingType($row[7]); + + $Order->addOrderItem($OrderItem); + } + + return $Order; } }