![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Sales\Block\Adminhtml; use Magento\Framework\View\LayoutInterface; use Magento\Sales\Model\Order; use Magento\Sales\Model\OrderFactory; /** * Test class for \Magento\Sales\Block\Adminhtml\Totals */ class TotalsTest extends \Magento\TestFramework\TestCase\AbstractBackendController { /** @var LayoutInterface */ private $layout; /** @var Totals */ private $block; /** @var OrderFactory */ private $orderFactory; /** * @inheritdoc */ protected function setUp(): void { parent::setUp(); $this->layout = $this->_objectManager->get(LayoutInterface::class); $this->block = $this->layout->createBlock(Totals::class, 'totals_block'); $this->orderFactory = $this->_objectManager->get(OrderFactory::class); } /** * @magentoDataFixture Magento/Sales/_files/order_with_free_shipping_by_coupon.php */ public function testShowShippingCoupon() { /** @var Order $order */ $order = $this->orderFactory->create(); $order->loadByIncrementId('100000001'); $this->block->setOrder($order); $this->block->toHtml(); $shippingTotal = $this->block->getTotal('shipping'); $this->assertNotFalse($shippingTotal, 'Shipping method is absent on the total\'s block.'); $this->assertStringContainsString( '1234567890', $shippingTotal->getLabel(), 'Coupon code is absent in the shipping method label name.' ); } }