Security update for Core, with self-updated composer
[yaffs-website] / web / core / tests / Drupal / FunctionalJavascriptTests / Core / Session / SessionTest.php
1 <?php
2
3 namespace Drupal\FunctionalJavascriptTests\Core\Session;
4
5 use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
6 use Drupal\menu_link_content\Entity\MenuLinkContent;
7
8 /**
9  * Tests that sessions don't expire.
10  *
11  * @group session
12  */
13 class SessionTest extends JavascriptTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['menu_link_content', 'block'];
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function setUp() {
24     parent::setUp();
25
26     $account = $this->drupalCreateUser();
27     $this->drupalLogin($account);
28
29     $menu_link_content = MenuLinkContent::create([
30       'title' => 'Link to front page',
31       'menu_name' => 'tools',
32       'link' => ['uri' => 'route:<front>'],
33     ]);
34     $menu_link_content->save();
35
36     $this->drupalPlaceBlock('system_menu_block:tools');
37   }
38
39   /**
40    * Tests that the session doesn't expire.
41    *
42    * Makes sure that drupal_valid_test_ua() works for multiple requests
43    * performed by the Mink browser. The SIMPLETEST_USER_AGENT cookie must always
44    * be valid.
45    */
46   public function testSessionExpiration() {
47     // Visit the front page and click the link back to the front page a large
48     // number of times.
49     $this->drupalGet('<front>');
50
51     $page = $this->getSession()->getPage();
52
53     for ($i = 0; $i < 25; $i++) {
54       $page->clickLink('Link to front page');
55     }
56   }
57
58 }