Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear Cache Before Every Test #55

Closed
mikebronner opened this issue Jan 11, 2018 · 4 comments
Closed

Clear Cache Before Every Test #55

mikebronner opened this issue Jan 11, 2018 · 4 comments
Assignees

Comments

@mikebronner
Copy link
Owner

It has come to light that some tests are squeaking by and passing because of existing cache entries. We have fixed this where found, but will address this as a whole, so that we can check with confidence that this doesn't occur anywhere else.

@sjbronner
Copy link
Contributor

sjbronner commented Jan 11, 2018

Aren't all existing cache entries cleared at the end of setUp() by cache()->flush()?
Where is that defined, anyway?

@mikebronner
Copy link
Owner Author

Ah yes, you're right. I forgot about that. So then why do you think we were getting false positives?

@sjbronner
Copy link
Contributor

Maybe it's not working. Can you tell me what code is run by that call?

@sjbronner
Copy link
Contributor

Looking at an example of a false positive result gave me further insight into the issue:
tests/Unit/CachedBuilderTest.php function testValueModelResultsCreatesCache was caching stuff under the specific key that was to be tested as well as additional keys as a side effect. One of those additional keys was then mistakenly used in the cache retrieval. The result was not the expected result. But as the result was a container containing the expected value, the first mistake was compounded by extracting the desired value from the returned container. Thus a successful comparison could be made. Test passed. Test was wrong.
In any case, the error was an error of the specific test, it was not systemic. It just so happened that this error was also present in another test. Both tests have previously been fixed. There is nothing to do here.

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

No branches or pull requests

2 participants