Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[6.x] Delete cached config file before running tests #5091
I ran into the problem that the bootstrapping of the unit tests crashed because the cached config file (
This problem happened to me when I removed a package that I had manually registered in my
Steps to reproduce:
You should see the following error:
I'm not very happy with this solution, but it works. Maybe someone has a better solution to this problem.
Also, this same bug might also exist with the other cached files.
I've included @timacdonald's suggestion on how to delete the files. Now we can be sure none of the cached files can give us any trouble.
I've also refactored the bootstrap file as a PHPunit extension, this has the following benefits:
I think this should probably be 2 PRs so discussion can happen independently for the two different changes, i.e.
But while it is here - a couple of thoughts on this approach:
This isn't really an issue. The files are .gitignored and before the introduction of this feature, running your test suite would already generate
We will also have to check how this plays with parallel test runners, i.e. that it only runs the extension hooks once per run and not once per thread.
I think this PR can be merged. I'm pretty sure it works just like the old code, and it solves the problem described in this issue.
Like @timacdonald said, i don't know if these hooks work with parallel test runners. But since these hooks are normal phpunit features, i'm not sure if this is something we should worry about.
Looks like ParaTest is hitting some issues due to its multi threaded-ness, but I have a solution that I think can just go in the docs. Will send a follow up PR to the docs about it.
p.s. @SjorsO I dig the extension over the plain bootstrap file. Nice being able to have a specific before and after hooks.