Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertOnlineInvoiceCannotBeCreated.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Sales\Test\Page\Adminhtml\OrderInvoiceNew;
10 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
11 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
12 use Magento\Mtf\Constraint\AbstractConstraint;
13 
17 class AssertOnlineInvoiceCannotBeCreated extends AbstractConstraint
18 {
22  const OFFLINE_INVOICE_MESSAGE = 'The invoice will be created offline without the payment gateway.';
23 
33  public function processAssert(
34  SalesOrderView $salesOrderView,
35  OrderIndex $salesOrder,
36  OrderInvoiceNew $orderInvoiceNew,
37  $orderId
38  ) {
39  $salesOrder->open();
40  $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
41  $salesOrderView->getPageActions()->invoice();
42 
43  \PHPUnit\Framework\Assert::assertEquals(
44  self::OFFLINE_INVOICE_MESSAGE,
45  $orderInvoiceNew->getTotalsBlock()->getCaptureOfflineMessage(),
46  'Message incorrect or is not present.'
47  );
48  }
49 
55  public function toString()
56  {
57  return "Message that invoice can be created only offline is present.";
58  }
59 }
processAssert(SalesOrderView $salesOrderView, OrderIndex $salesOrder, OrderInvoiceNew $orderInvoiceNew, $orderId)