You are here

public function AccountProxyTest::testSetInitialAccountIdException in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php \Drupal\Tests\Core\Session\AccountProxyTest::testSetInitialAccountIdException()
  2. 9 core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php \Drupal\Tests\Core\Session\AccountProxyTest::testSetInitialAccountIdException()

@covers ::setInitialAccountId

File

core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php, line 42

Class

AccountProxyTest
@coversDefaultClass \Drupal\Core\Session\AccountProxy @group Session

Namespace

Drupal\Tests\Core\Session

Code

public function testSetInitialAccountIdException() {
  $this
    ->expectException(\LogicException::class);
  $dispatcher = $this
    ->prophesize(EventDispatcherInterface::class);
  $dispatcher
    ->dispatch(Argument::any(), Argument::any())
    ->willReturn(new Event());
  $account_proxy = new AccountProxy($dispatcher
    ->reveal());
  $current_user = $this
    ->prophesize(AccountInterface::class);
  $account_proxy
    ->setAccount($current_user
    ->reveal());
  $account_proxy
    ->setInitialAccountId(1);
}