Skip to content

tests: ensure a lifetime configured in userland is used by the helper#360

Open
Amoifr wants to merge 1 commit into
SymfonyCasts:mainfrom
Amoifr:test-317-lifetime-config
Open

tests: ensure a lifetime configured in userland is used by the helper#360
Amoifr wants to merge 1 commit into
SymfonyCasts:mainfrom
Amoifr:test-317-lifetime-config

Conversation

@Amoifr

@Amoifr Amoifr commented Jul 11, 2026

Copy link
Copy Markdown

Closes #317.

Adds an integration test covering what the issue asks for: when an app overrides lifetime in its bundle config, that value is the one the helper actually ends up with.

The helper is a private service, so the test autowires it into a small public holder (same trick as ResetPasswordInterfaceAutowireTest), boots a kernel with lifetime: 9999, and asserts getTokenLifetime(). A second test pins the 3600 default, so both directions are locked.

I checked it isn't a test that can't fail: hardcoding $helperDefinition->replaceArgument(3, 3600) in the extension makes the userland test fail with Failed asserting that 3600 is identical to 9999, while the default one stays green.

Full suite: 92 tests, 147 assertions, green (90 before).

One thing worth your call, @jrushlow: the issue is prefixed [2.x], but I targeted main. The 2.x branch hasn't moved since August 2024 and has drifted structurally (src/DependencyInjection/SymfonyCastsResetPasswordExtension.php doesn't even exist there anymore), while the wiring the issue is about is alive and well on main. Happy to retarget or port it if you'd rather have it on 2.x.

Thanks for the bundle — it's one of those things that quietly saves everyone a week of fiddling with token hashing. 🙂

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.

[2.x] add test to ensure if lifetime is changed in userland - the new value is used in the helper

1 participant