class SessionTest
Same name in this branch
- 9 core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest
- 11.x core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php \Drupal\FunctionalJavascriptTests\Core\Session\SessionTest
- 10 core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest
- 10 core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php \Drupal\FunctionalJavascriptTests\Core\Session\SessionTest
- 8.9.x core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest
- 8.9.x core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php \Drupal\FunctionalJavascriptTests\Core\Session\SessionTest
Tests that sessions don't expire.
@group session
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase implements \Drupal\Tests\BrowserTestBase
- class \Drupal\FunctionalJavascriptTests\Core\Session\SessionTest implements \Drupal\FunctionalJavascriptTests\WebDriverTestBase
- class \Drupal\FunctionalJavascriptTests\WebDriverTestBase implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of SessionTest
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ Core/ Session/ SessionTest.php, line 13
Namespace
Drupal\FunctionalJavascriptTests\Core\SessionView source
class SessionTest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'menu_link_content',
'block',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$account = $this->drupalCreateUser();
$this->drupalLogin($account);
$menu_link_content = MenuLinkContent::create([
'title' => 'Link to front page',
'menu_name' => 'tools',
'link' => [
'uri' => 'route:<front>',
],
]);
$menu_link_content->save();
$this->drupalPlaceBlock('system_menu_block:tools');
}
/**
* Tests that the session doesn't expire.
*
* Makes sure that drupal_valid_test_ua() works for multiple requests
* performed by the Mink browser. The SIMPLETEST_USER_AGENT cookie must always
* be valid.
*/
public function testSessionExpiration() {
// Visit the front page and click the link back to the front page a large
// number of times.
$this->drupalGet('<front>');
$page = $this->getSession()
->getPage();
for ($i = 0; $i < 25; $i++) {
$page->clickLink('Link to front page');
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.