Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertInvoiceItems.php
Go to the documentation of this file.
1 <?php
8 
11 use Magento\Sales\Test\Page\Adminhtml\InvoiceIndex;
12 use Magento\Sales\Test\Page\Adminhtml\SalesInvoiceView;
13 
18 {
29  public function processAssert(
30  InvoiceIndex $invoiceIndex,
31  SalesInvoiceView $salesInvoiceView,
32  OrderInjectable $order,
33  array $ids,
34  Cart $cart = null
35  ) {
36  $orderId = $order->getId();
37  $invoicesData = $order->getInvoice();
38  $data = isset($invoicesData[0]['items_data']) ? $invoicesData[0]['items_data'] : [];
39  $productsData = $this->prepareOrderProducts($order, $data, $cart);
40  foreach ($ids['invoiceIds'] as $invoiceId) {
41  $filter = [
42  'order_id' => $orderId,
43  'id' => $invoiceId,
44  ];
45  $invoiceIndex->open();
46  $invoiceIndex->getInvoicesGrid()->searchAndOpen($filter);
47  $itemsData = $this->preparePageItems($salesInvoiceView->getItemsBlock()->getData());
48  $error = $this->verifyData($productsData, $itemsData);
49  \PHPUnit\Framework\Assert::assertEmpty($error, $error);
50  }
51  }
52 
58  public function toString()
59  {
60  return 'All invoice products are present in invoice view page.';
61  }
62 }
$productsData
Definition: products.php:19
$order
Definition: order.php:55
verifyData(array $fixtureData, array $formData, $isStrict=false, $isPrepareError=true)
processAssert(InvoiceIndex $invoiceIndex, SalesInvoiceView $salesInvoiceView, OrderInjectable $order, array $ids, Cart $cart=null)