Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertShipmentInShipmentsGrid.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Shipping\Test\Page\Adminhtml\ShipmentIndex;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
17 class AssertShipmentInShipmentsGrid extends AbstractConstraint
18 {
27  public function processAssert(ShipmentIndex $shipmentIndex, OrderInjectable $order, array $ids)
28  {
29  $shipmentIndex->open();
30  $orderId = $order->getId();
31  $totalQty = $order->getTotalQtyOrdered();
32  foreach ($ids['shipmentIds'] as $key => $shipmentIds) {
33  $filter = [
34  'id' => $shipmentIds,
35  'order_id' => $orderId
36  ];
37  $filterQty = [
38  'total_qty_from' => $totalQty[$key],
39  'total_qty_to' => $totalQty[$key],
40  ];
41  $shipmentIndex->getShipmentsGrid()->search($filter + $filterQty);
42  \PHPUnit\Framework\Assert::assertTrue(
43  $shipmentIndex->getShipmentsGrid()->isRowVisible($filter, false),
44  'Shipment is absent in shipment grid on shipment index page.'
45  );
46  }
47  }
48 
54  public function toString()
55  {
56  return 'Shipment is present in the shipment grid with correct total qty on shipment index page.';
57  }
58 }
processAssert(ShipmentIndex $shipmentIndex, OrderInjectable $order, array $ids)
$order
Definition: order.php:55