Always Clean Install in PHPUnit Tests
|Reported by:||bpetty||Owned by:||wonderboymusic|
The unit tests only re-install WordPress from a previous run if using a different config (multisite vs single), it requires a DB upgrade (checking db_version), or wp-tests-config.php changes in any way (hashed). This was originally introduced from @nbachiyski with the test runner rewrite, and modified again by @gcorne to account for wp-tests-config.php.
The problem with doing this lies in these areas though:
- In transitioning these unit tests to run against the build version instead of src (and we do want to do this soon after this change), we should never leave extra files like .wp-tests-version in the build directory that could be accidentally packaged with WP even if it was ignored in SVN.
- We should always assume failure from previous unit test runs, and always build and test from a clean install. It doesn't matter if it's the same db_version and install type, anything could have gone wrong and leave us with incorrect testing results affected by previous runs.
- Most of the time, this is actually ineffective because testers should already be running both the single site, and multisite tests one after the other, causing a re-install with the current code anyway.
Besides the above though, re-installing WordPress takes less than a second compared with the 3 to 5 minutes the actual tests take anyway. It's not slowing down the tests any.
Change History (5)
comment:3 wonderboymusic — 4 months ago
- Owner set to wonderboymusic
- Resolution set to fixed
- Status changed from new to closed