Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertAwaitingSignifydGuaranteeInCommentsHistory.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 AssertAwaitingSignifydGuaranteeInCommentsHistory extends AbstractConstraint
17 {
21  private $historyComment = 'Awaiting the Signifyd guarantee disposition.';
22 
26  private $historyCommentStatus = 'On Hold';
27 
34  public function processAssert(
35  SalesOrderView $salesOrderView,
36  OrderIndex $salesOrder,
37  $orderId
38  ) {
39  $salesOrder->open();
40  $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
41 
43  $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
44  $orderComments = $infoTab->getCommentsHistoryBlock()->getComments();
45 
46  $key = array_search(
47  $this->historyComment,
48  array_column($orderComments, 'comment')
49  );
50 
51  \PHPUnit\Framework\Assert::assertNotFalse(
52  $key,
53  'There is no message about awaiting the Signifyd guarantee disposition' .
54  ' in Comments History section for the order #' . $orderId
55  );
56 
57  \PHPUnit\Framework\Assert::assertEquals(
58  $this->historyCommentStatus,
59  $orderComments[$key]['status'],
60  'Message about awaiting the Signifyd guarantee disposition' .
61  ' doesn\'t have status "'. $this->historyCommentStatus.'"' .
62  ' in Comments History section for the order #' . $orderId
63  );
64  }
65 
69  public function toString()
70  {
71  return "Message about awaiting the Signifyd guarantee disposition is available in Comments History section.";
72  }
73 }