Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertShipmentInShipmentsTab.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
11 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
12 use Magento\Mtf\Constraint\AbstractConstraint;
13 
17 class AssertShipmentInShipmentsTab extends AbstractConstraint
18 {
28  public function processAssert(
29  SalesOrderView $salesOrderView,
30  OrderIndex $orderIndex,
31  OrderInjectable $order,
32  array $ids
33  ) {
34  $orderIndex->open();
35  $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
36  $salesOrderView->getOrderForm()->openTab('shipments');
37  $totalQty = $order->getTotalQtyOrdered();
38  $totalQty = is_array($totalQty) ? $totalQty : [$totalQty];
39 
40  foreach ($ids['shipmentIds'] as $key => $shipmentId) {
41  $filter = [
42  'id' => $shipmentId,
43  'qty_from' => number_format($totalQty[$key], 4, '.', ''),
44  'qty_to' => number_format($totalQty[$key], 4, '.', ''),
45  ];
46  \PHPUnit\Framework\Assert::assertTrue(
47  $salesOrderView
48  ->getOrderForm()
49  ->getTab('shipments')
50  ->getGridBlock()
51  ->isRowVisible($filter, true, false),
52  'Shipment is absent on shipments tab.'
53  );
54  }
55  }
56 
62  public function toString()
63  {
64  return 'Shipment is present on shipments tab.';
65  }
66 }
processAssert(SalesOrderView $salesOrderView, OrderIndex $orderIndex, OrderInjectable $order, array $ids)
$order
Definition: order.php:55