Skip to content

test: share the request instance in the invalid session cookie tests - #10799

Merged
paulbalandan merged 1 commit into
codeigniter4:4.8from
paulbalandan:session-test-shared-request
Nov 20, 2026
Merged

paulbalandan merged 1 commit into
codeigniter4:4.8from
paulbalandan:session-test-shared-request

Conversation

@paulbalandan

Copy link
Copy Markdown
Member

Description
After merging develop into 4.8, SessionTest::testStartScopesInvalidSessionCookieRemovalToSessionCookie() fails in the SeparateProcess group.

On 4.8, Services::request() returns a new unshared request when none is registered, while on develop it is shared. The test and Session::start() therefore held different request objects, and the one in the test kept the invalid cookie in its cached globals. createRequest() registers the request in real runs, so only the tests are affected.

Both invalid session cookie tests now register their request with Services::injectMock('request', $request) and assert against it. This also makes testStartUnsetsInvalidSessionCookieInSuperglobalsAndRequest() check the request cleanup, which it passed without before.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@carson-codeigniter4 carson-codeigniter4 Bot added 4.8 PRs that target the `4.8` branch. testing Pull requests that changes tests only labels Nov 19, 2026
@paulbalandan
paulbalandan merged commit f33fb84 into codeigniter4:4.8 Nov 20, 2026
51 checks passed
@paulbalandan
paulbalandan deleted the session-test-shared-request branch November 20, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.8 PRs that target the `4.8` branch. testing Pull requests that changes tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants