Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertVoidInCommentsHistory.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
10 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
16 class AssertVoidInCommentsHistory extends AbstractConstraint
17 {
21  const VOIDED_AMOUNT = 'Voided authorization. Amount: $';
22 
32  public function processAssert(
33  SalesOrderView $salesOrderView,
34  OrderIndex $salesOrder,
35  $orderId,
36  array $prices
37  ) {
38  $salesOrder->open();
39  $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
40 
42  $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
43  $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
44 
45  \PHPUnit\Framework\Assert::assertContains(
46  self::VOIDED_AMOUNT . $prices['grandTotal'],
47  $latestComment['comment'],
48  'Incorrect voided amount value for the order #' . $orderId
49  );
50  }
51 
57  public function toString()
58  {
59  return "Message about voided amount is available in Comments History section.";
60  }
61 }