Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertOrderCommentsHistoryNotifyStatus.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Mtf\Constraint\AbstractConstraint;
10 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
11 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
12 
16 class AssertOrderCommentsHistoryNotifyStatus extends AbstractConstraint
17 {
25  public function processAssert(
26  SalesOrderView $salesOrderView,
27  OrderIndex $salesOrder,
28  OrderInjectable $order
29  ) {
30  $salesOrder->open();
31  $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
32  $refundsData = $order->getRefund();
33  $sendMail = isset($refundsData[0]['form_data']['send_email'])
34  ? filter_var($refundsData[0]['form_data']['send_email'], FILTER_VALIDATE_BOOLEAN)
35  : false;
37  $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
38  $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
39 
40  \PHPUnit\Framework\Assert::assertContains(
41  $latestComment['is_customer_notified'],
42  (bool)$sendMail ? 'Customer Notified' : 'Customer Not Notified'
43  );
44  }
45 
51  public function toString()
52  {
53  return "Message with appropriate notification status is available in Comments History section.";
54  }
55 }
$order
Definition: order.php:55