SessionTest.php in Drupal 9
File
core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php
View source
<?php
namespace Drupal\FunctionalJavascriptTests\Core\Session;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\menu_link_content\Entity\MenuLinkContent;
class SessionTest extends WebDriverTestBase {
protected static $modules = [
'menu_link_content',
'block',
];
protected $defaultTheme = 'stark';
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');
}
public function testSessionExpiration() {
$this
->drupalGet('<front>');
$page = $this
->getSession()
->getPage();
for ($i = 0; $i < 25; $i++) {
$page
->clickLink('Link to front page');
}
}
}