Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertSignifydCaseInCommentsHistory.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
9 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
16 class AssertSignifydCaseInCommentsHistory extends AbstractConstraint
17 {
21  const CASE_CREATED_PATTERN = '/Signifyd Case (\d)+ has been created for order\./';
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::assertRegExp(
43  self::CASE_CREATED_PATTERN,
44  implode('. ', $commentsMessages),
45  'Signifyd case is not created for the order #' . $orderId
46  );
47  }
48 
52  public function toString()
53  {
54  return "Message about Signifyd Case is available in Comments History section.";
55  }
56 }