Add Auto Expiry Feature #111
Conversation
Use a new test case class where the instance is set up differently. None of the other properties have setters.
*/ | ||
protected function _getAutoExpiringLifetime($lifetime, $id) | ||
{ | ||
if ($lifetime) { |
colinmollenhour
Oct 1, 2016
Owner
No reason to check if it matches the pattern if the feature is disabled. I recommend short-circuiting by changing this to:
if ($lifetime || ! $this->_autoExpireLifetime) {
No reason to check if it matches the pattern if the feature is disabled. I recommend short-circuiting by changing this to:
if ($lifetime || ! $this->_autoExpireLifetime) {
mpchadwick
Oct 1, 2016
Author
Contributor
Good call. Done.
Good call. Done.
return !empty($matches); | ||
} | ||
|
||
public function setAutoExpireLifetime($lifetime) |
colinmollenhour
Oct 1, 2016
•
Owner
Other options are not exposed this way... Is there a reason they need to be set aside from the constructor?
Other options are not exposed this way... Is there a reason they need to be set aside from the constructor?
mpchadwick
Oct 1, 2016
Author
Contributor
The reason I added the setters was to be able to change the properties for testAutoExpiry
. Maybe there's a better way, but I'm not sure. I tried Googling to see if setUp
could tell what test method as being called, but couldn't find any information about that.
The reason I added the setters was to be able to change the properties for testAutoExpiry
. Maybe there's a better way, but I'm not sure. I tried Googling to see if setUp
could tell what test method as being called, but couldn't find any information about that.
colinmollenhour
Oct 3, 2016
Owner
I think the proper way would be to have a new test case class for these tests that require a different setUp method.
I think the proper way would be to have a new test case class for these tests that require a different setUp method.
mpchadwick
Oct 3, 2016
Author
Contributor
@colinmollenhour Updated with a separate test case. I'm following the pattern introduced with forceStandalone
where a protected property is used and can be changed in the new test case class. Happy to squash these down as a final step if you'd like.
@colinmollenhour Updated with a separate test case. I'm following the pattern introduced with forceStandalone
where a protected property is used and can be changed in the new test case class. Happy to squash these down as a final step if you'd like.
Looks good! Thanks, Max! |
Implementation of feature discussed in #110.