You are here

public function InvoiceOrderAccessCheckTest::testAccessForDraftOrders in Commerce Invoice 8.2

@covers ::access

File

tests/src/Kernel/InvoiceOrderAccessCheckTest.php, line 50

Class

InvoiceOrderAccessCheckTest
Tests the 'access_check.invoice_order' access checker.

Namespace

Drupal\Tests\commerce_invoice\Kernel

Code

public function testAccessForDraftOrders() {

  // The order created in the parent ::setUp() method is in a draft state, so
  // access to create invoices for it shouldn't be allowed.
  $this
    ->assertEquals('draft', $this->order
    ->getState()
    ->getId());
  $access = $this->accessChecker
    ->access($this
    ->getRoute(), $this
    ->getRouteMatch($this->order), $this
    ->getAccount());
  $this
    ->assertFalse($access
    ->isAllowed());
}