Commit 4d19bbd
committed
test[faustwp]: stop AuthCallbacksTests leaking REQUEST_URI to other test classes
phpunit.xml.dist sets backupGlobals="false", so anything mutated on
$_SERVER and $_GET inside one test class persists to the next. Our
tearDown was doing 'unset($_SERVER[REQUEST_URI])' as cleanup, which
poisoned the cron path that runs during TelemetryCallbacksTests::setUp()
(do_action('muplugins_loaded') -> wp-cron -> reads REQUEST_URI). With
convertNoticesToExceptions=true, the missing key turned into 9 hard
errors on the next test class.
Local --filter=AuthCallbacks didn't surface this because TelemetryCallbacks
was excluded. CI runs the full suite and caught it on WP 6.5 and Nightly.
Fix: snapshot $_SERVER['REQUEST_URI'] and $_GET in setUp; restore them in
tearDown. The world is left as we found it, regardless of what the WP test
bootstrap or earlier test classes had configured.
Verified locally:
- Full suite (composer test, single-site + multisite): 126 tests, 291
assertions, all pass.
- Regression guard preserved: reverting callbacks.php to site_url() still
fails the Bedrock + WP-in-subdirectory tests cleanly.
- Without this fix, the same full suite errors 9 times in
TelemetryCallbacksTests with 'Undefined array key REQUEST_URI' --
matching the CI failure exactly.1 parent 47c9f7e commit 4d19bbd
1 file changed
Lines changed: 31 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
45 | 61 | | |
46 | 62 | | |
47 | 63 | | |
48 | 64 | | |
49 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
50 | 70 | | |
51 | 71 | | |
52 | 72 | | |
| |||
65 | 85 | | |
66 | 86 | | |
67 | 87 | | |
68 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
69 | 99 | | |
70 | 100 | | |
71 | 101 | | |
| |||
0 commit comments