Skip to content

[12.x] Test SessionGuard::user() with recaller cookie that has an empty remember token - #62156

Merged
taylorotwell merged 2 commits into
13.xfrom
copilot/add-test-coverage-user-from-recaller
Oct 24, 2026
Merged

taylorotwell merged 2 commits into
13.xfrom
copilot/add-test-coverage-user-from-recaller

Conversation

Copilot AI commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

SessionGuard::userFromRecaller had no test for a recaller cookie whose remember-token segment is empty. This PR adds one.

  • tests/Auth/AuthGuardTest.php
    • Adds testUserReturnsNullWhenRememberCookieHasEmptyToken, which uses the cookie value id||baz.
    • Asserts that user() returns null, viaRemember() is false, and retrieveByToken is never called.
    • The provider is never called because Recaller::valid() rejects an empty token segment, so userFromRecaller returns early.
$request = Request::create('/', 'GET', [], [$guard->getRecallerName() => 'id||baz']);
// ...
$guard->getProvider()->shouldReceive('retrieveByToken')->never();
$this->assertNull($guard->user());
$this->assertFalse($guard->viaRemember());

This PR adds no production code changes.

I could not run the new test locally because dependencies could not be installed in the sandbox, so it needs a CI run.

Co-authored-by: crynobone <172966+crynobone@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test coverage for SessionGuard userFromRecaller with empty token [12.x] Test SessionGuard::user() with recaller cookie that has an empty remember token Oct 23, 2026
Copilot AI requested a review from crynobone October 23, 2026 05:25
@crynobone
crynobone marked this pull request as ready for review October 23, 2026 05:29
@taylorotwell
taylorotwell merged commit af08f63 into 13.x Oct 24, 2026
2 checks passed
@taylorotwell
taylorotwell deleted the copilot/add-test-coverage-user-from-recaller branch October 24, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants