Skip to content

Commit 3ae814c

Browse files
committed
MC-42332: [Magento Cloud] some Invoice and order not loading properly after upgrade to 2.4.1
- modify integration test
1 parent d648bdc commit 3ae814c

File tree

1 file changed

+24
-1
lines changed
  • dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order

1 file changed

+24
-1
lines changed

dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/TotalsTest.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use Magento\Sales\Api\Data\OrderInterfaceFactory;
1414
use Magento\Sales\Block\Adminhtml\Order\Totals\Tax;
1515
use Magento\Sales\Model\Order;
16+
use Magento\Tax\Model\ResourceModel\Sales\Order\Tax\Collection as TaxCollection;
17+
use Magento\Tax\Model\Sales\Order\Tax as SalesTax;
1618
use Magento\TestFramework\Helper\Bootstrap;
1719
use PHPUnit\Framework\TestCase;
1820

@@ -51,8 +53,9 @@ protected function setUp(): void
5153
*
5254
* @magentoConfigFixture default_store tax/sales_display/subtotal 2
5355
* @magentoConfigFixture default_store tax/sales_display/shipping 2
56+
* @magentoConfigFixture default_store tax/sales_display/full_summary 1
5457
*
55-
* @magentoDataFixture Magento/Sales/_files/order.php
58+
* @magentoDataFixture Magento/Tax/_files/order_with_tax.php
5659
*
5760
* @return void
5861
*/
@@ -68,6 +71,11 @@ public function testTotalsInclTax(): void
6871
$blockTotals->setChild('child_tax_block', $blockTax);
6972
$blockTax->initTotals();
7073

74+
/** @var TaxCollection $taxCollection */
75+
$taxCollection = $this->om->get(TaxCollection::class);
76+
$tax = $taxCollection->loadByOrder($order)->getItems();
77+
$tax = array_pop($tax);
78+
$this->assertTaxRate($blockTax->toHtml(), $tax);
7179
$this->assertSubtotal($blockTotals->toHtml(), (float) $order->getSubtotalInclTax());
7280
$this->assertShipping($blockTotals->toHtml(), (float) $order->getShippingInclTax());
7381
}
@@ -132,6 +140,21 @@ private function assertShipping(string $blockTotalsHtml, float $amount): void
132140
);
133141
}
134142

143+
/**
144+
* Check if tax rate present in block.
145+
*
146+
* @param string $blockTaxHtml
147+
* @param SalesTax $tax
148+
* @return void
149+
*/
150+
private function assertTaxRate(string $blockTaxHtml, SalesTax $tax)
151+
{
152+
$this->assertStringContainsString(
153+
$tax->getTitle() . ' (' . (int)$tax->getAmount() . '%)',
154+
$blockTaxHtml
155+
);
156+
}
157+
135158
/**
136159
* Prepare order for test.
137160
*

0 commit comments

Comments
 (0)