1313use Magento \Sales \Api \Data \OrderInterfaceFactory ;
1414use Magento \Sales \Block \Adminhtml \Order \Totals \Tax ;
1515use 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 ;
1618use Magento \TestFramework \Helper \Bootstrap ;
1719use 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