Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertDenyPaymentMessageInCommentsHistory.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Mtf\Constraint\AbstractConstraint;
9 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
10 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
11 
17 class AssertDenyPaymentMessageInCommentsHistory extends AbstractConstraint
18 {
24  private static $message = 'Denied the payment online';
25 
34  public function processAssert(SalesOrderView $salesOrderView, OrderIndex $orderIndex, $orderId)
35  {
36  $orderIndex->open();
37  $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
38 
40  $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
41  $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
42 
43  \PHPUnit\Framework\Assert::assertContains(self::$message, $latestComment['comment']);
44  }
45 
51  public function toString()
52  {
53  return 'Message about denied payment is available in Comments History section.';
54  }
55 }
$message