Cookie base path not check in the test but set in code

Created on 8 September 2023, 12 months ago
Updated 11 September 2023, 12 months ago

Problem/Motivation

The Drupal.toolbar.collapsed is always set taking into account the $base_path, but the test does not take this into account and only checks for /, so if you run the tests in a subdirectory, the testToolbarCollapsedCookie fails.

These are the instances where the cookie can be set:
- toolbar.module

drupal_setcookie('Drupal.toolbar.collapsed', !_toolbar_is_collapsed(),
    array(
      'samesite' => 'Lax',
      'path' => $base_path,
    )
);

- toolbar.js

$.cookie(
    'Drupal.toolbar.collapsed',
    0,
    {
      // Workaround lack of support for the SameSite attribute in jQuery Cookie.
      path: Drupal.settings.basePath + '; SameSite=Lax',
      // The cookie should "never" expire.
      expires: 36500
    }
);

The base path is always set, so the test should match this too.

We are migrating DrupalCI to GitlabCI for Drupal 7, and if this is one of the blockers.

Steps to reproduce

See the failed run here in GitlabCI: https://git.drupalcode.org/project/gitlab_ci_testbed_for_drupal_core/-/j...
I added additional output messages here to see what was the reason: https://git.drupalcode.org/project/gitlab_ci_testbed_for_drupal_core/-/j...

Proposed resolution

Add the check for the base path in the tests.

Remaining tasks

MR to follow.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

7.0 ⚰️

Component
ToolbarΒ  β†’

Last updated 4 days ago

  • Maintained by
  • πŸ‡«πŸ‡·France @nod_
Created by

πŸ‡ͺπŸ‡ΈSpain fjgarlin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024