Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertSignifydGuaranteeCancelInCommentsHistory.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 
16 class AssertSignifydGuaranteeCancelInCommentsHistory extends AbstractConstraint
17 {
21  private $guaranteeCancelMessage = 'Case Update: Case guarantee has been cancelled.';
22 
29  public function processAssert(
30  SalesOrderView $salesOrderView,
31  OrderIndex $salesOrder,
32  $orderId
33  ) {
34  $salesOrder->open();
35  $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
36 
38  $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
39  $orderComments = $infoTab->getCommentsHistoryBlock()->getComments();
40  $commentsMessages = array_column($orderComments, 'comment');
41 
42  \PHPUnit\Framework\Assert::assertContains(
43  $this->guaranteeCancelMessage,
44  implode('. ', $commentsMessages),
45  'There is no message regarding Signifyd guarantee cancel in Comments History section for the order #'
46  . $orderId
47  );
48  }
49 
53  public function toString()
54  {
55  return "Message about Signifyd guarantee cancel is available in Comments History section.";
56  }
57 }