Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@final
with PHPfinal
keyword. Which in turn cleans up our tests a wee-bit..As a side effect of that, we need to be able to mock
ResetPasswordRandomGenerator
,ResetPasswordTokenGenerator
, &ResetPasswordCleaner
. Which you cannot do when using thefinal
keyword.One work around would be to use something like https://github.com/dg/bypass-finals. This approach is cool, but it's more or less a "one size fits all" approach. Part of our tests guarantee that we are not using
final
classes where we shouldnt. So instead of "flaky" tests, I went with...Implementing
interface
's for the classes we need to mock. I'm usually the first to say NO when it comes to adding to the public API that will increase our maintenance burden / technical debt. But, I think having these interfaces will be beneficial in the long run.a) We sort of tease that hey, you can create your own
ResetPasswordHelper
by implementing theResetPasswordHelperInterface
. But as you dig deeper down the rabbit hole, you quickly find out that you can't actually do that. Mostly because our generators, models, and utils arefinal
xorinternal
(As they should be). Swapping out the concreteargument
andreturn
types with the interfaces allows developers to truly implement their own customized implementations without needing us to change our own implementations in the bundle.and
b) should there be better, more secure, less problematic, etc. methods of doing say,
generateToken()
, providing an interface will take some of the pressure off of us to push out a fix while trying to preserve BC. Atleast, thats the goal.Todo: