Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

drop request's scriptFile checks in favour of getlastmod() built-in function #39

Merged
merged 4 commits into from
Feb 28, 2019

Conversation

pine3ree
Copy link
Contributor

@pine3ree pine3ree commented Feb 28, 2019

a little refactoring

  • It allows us to let php do the dirty job for us (with the same result), thus removing distracting lines and properties from the persistence class (I'had never used this function before, I mean since 2001...., I stumbled upon it recently)
  • dropped a few related test cases that do not apply anymore (my coveralls account still says 100% coverage)

Note:
I would have liked to test different getLastModified() return values, but: 1) I cannot find a way to mock builtin php functions return values (getlastmod, filemetime) without using pecl extensions. 2) I could mock the return value of getLastModified using an inline class, but at the expense of changing the visibility of the method to "protected".

}

return false;
$lastmod = getlastmod() ?: filemtime(__FILE__);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is such a nice find - I'd never known about that, and it was the exact functionality I was trying to create previously!

@weierophinney weierophinney merged commit 6170453 into zendframework:develop Feb 28, 2019
weierophinney added a commit that referenced this pull request Feb 28, 2019
drop request's scriptFile checks in favour of getlastmod() built-in function
weierophinney added a commit that referenced this pull request Feb 28, 2019
@weierophinney
Copy link
Member

Thanks, @pine3ree!

@pine3ree pine3ree deleted the use-getlastmod branch March 5, 2019 19:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants