You are here

protected function AgreementSubscriberTest::getAccountStub in Agreement 8.2

Same name and namespace in other branches
  1. 3.0.x tests/src/Unit/EventSubscriber/AgreementSubscriberTest.php \Drupal\Tests\agreement\Unit\EventSubscriber\AgreementSubscriberTest::getAccountStub()

Get the mocked current user account object.

Parameters

bool $canBypass: Can the user bypass agreement.

Return value

object The mocked user account object.

1 call to AgreementSubscriberTest::getAccountStub()
AgreementSubscriberTest::testCheckForRedirection in tests/src/Unit/EventSubscriber/AgreementSubscriberTest.php
Asserts that check for redirection method is functional.

File

tests/src/Unit/EventSubscriber/AgreementSubscriberTest.php, line 69

Class

AgreementSubscriberTest
Tests the agreement route subscriber.

Namespace

Drupal\Tests\agreement\Unit\EventSubscriber

Code

protected function getAccountStub($canBypass = FALSE) {
  $accountProphet = $this
    ->prophesize('\\Drupal\\Core\\Session\\AccountProxyInterface');
  $accountProphet
    ->hasPermission('bypass agreement')
    ->willReturn($canBypass);
  return $accountProphet
    ->reveal();
}