function RouterTest::testUserAccount
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Routing/RouterTest.php \Drupal\Tests\system\Functional\Routing\RouterTest::testUserAccount()
- 8.9.x core/modules/system/tests/src/Functional/Routing/RouterTest.php \Drupal\Tests\system\Functional\Routing\RouterTest::testUserAccount()
- 10 core/modules/system/tests/src/Functional/Routing/RouterTest.php \Drupal\Tests\system\Functional\Routing\RouterTest::testUserAccount()
Tests the user account on the DIC.
File
-
core/
modules/ system/ tests/ src/ Functional/ Routing/ RouterTest.php, line 276
Class
- RouterTest
- Functional class for the full integrated routing system.
Namespace
Drupal\Tests\system\Functional\RoutingCode
public function testUserAccount() : void {
$account = $this->drupalCreateUser();
$this->drupalLogin($account);
$second_account = $this->drupalCreateUser();
$this->drupalGet('router_test/test12/' . $second_account->id());
$this->assertSession()
->pageTextContains($account->getAccountName() . ':' . $second_account->getAccountName());
$this->assertEquals($this->loggedInUser
->id(), $account->id(), 'Ensure that the user was not changed.');
$this->drupalGet('router_test/test13/' . $second_account->id());
$this->assertSession()
->pageTextContains($account->getAccountName() . ':' . $second_account->getAccountName());
$this->assertEquals($this->loggedInUser
->id(), $account->id(), 'Ensure that the user was not changed.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.