You are here

public function OrderInvoiceTest::testPrintOrderInvoice in Ubercart 8.4

Tests order invoice tab print invoice.

File

uc_order/tests/src/Functional/OrderInvoiceTest.php, line 106

Class

OrderInvoiceTest
Tests order administration page invoice tab functionality.

Namespace

Drupal\Tests\uc_order\Functional

Code

public function testPrintOrderInvoice() {
  $this
    ->drupalLogin($this->adminUser);

  /** @var \Drupal\Tests\WebAssert $assert */
  $assert = $this
    ->assertSession();

  // Check to make sure the page can be viewed without error.
  $this
    ->drupalGet('admin/store/orders/' . $this->order
    ->id() . '/invoice/print');
  $assert
    ->statusCodeEquals(200);

  // Check for 'Print invoice' and 'Back' buttons.
  $assert
    ->buttonExists('Print invoice');
  $assert
    ->buttonExists('Back');

  // Check for some elements of invoice content to ensure it rendered.
  $assert
    ->linkByHrefExists('user/' . $this->customer
    ->id() . '/orders/' . $this->order
    ->id());
  $assert
    ->pageTextContains($this->order
    ->getEmail());
  $assert
    ->pageTextContains($this->order
    ->getAddress('billing')
    ->getZone());
}