You are here

public function PaymentReferenceTest::testResumeContextAccess in Payment 8.2

@covers ::resumeContextAccess

@dataProvider providerTestResumeContextAccess

File

modules/payment_reference/tests/src/Unit/Plugin/Payment/Type/PaymentReferenceTest.php, line 204

Class

PaymentReferenceTest
@coversDefaultClass \Drupal\payment_reference\Plugin\Payment\Type\PaymentReference

Namespace

Drupal\Tests\payment_reference\Unit\Plugin\Payment\Type

Code

public function testResumeContextAccess($expected, $payment_owner_id, $account_id) {
  $account = $this
    ->createMock(AccountInterface::class);
  $account
    ->expects($this
    ->atLeastOnce())
    ->method('id')
    ->willReturn($account_id);
  $this->payment
    ->expects($this
    ->atLeastOnce())
    ->method('getOwnerId')
    ->willReturn($payment_owner_id);
  $access = $this->sut
    ->resumeContextAccess($account);
  $this
    ->assertInstanceOf(AccessResultInterface::class, $access);
  $this
    ->assertSame($expected, $access
    ->isAllowed());
}