function AccountProxyTest::testSetInitialAccountIdException

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php \Drupal\Tests\Core\Session\AccountProxyTest::testSetInitialAccountIdException()
  2. 10 core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php \Drupal\Tests\Core\Session\AccountProxyTest::testSetInitialAccountIdException()
  3. 9 core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php \Drupal\Tests\Core\Session\AccountProxyTest::testSetInitialAccountIdException()
  4. 8.9.x core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php \Drupal\Tests\Core\Session\AccountProxyTest::testSetInitialAccountIdException()

Tests set initial account id exception.

File

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

Class

AccountProxyTest
Tests Drupal\Core\Session\AccountProxy.

Namespace

Drupal\Tests\Core\Session

Code

public function testSetInitialAccountIdException() : void {
  $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.