Opened 11 years ago
Closed 11 years ago
#32636 closed defect (bug) (fixed)
$_SERVER['REQUEST_METHOD'] isn't set in the test environment
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.3 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Build/Test Tools | Keywords: | has-patch |
| Focuses: | Cc: |
Description
A plugin of mine calls wp_validate_auth_cookie() in its unit tests, but this triggers a PHP notice because this function uses $_SERVER['REQUEST_METHOD'] which isn't set in the WordPress unit test environment.
Attachments (1)
Change History (6)
#1
@
11 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Awaiting Review to 4.3
#2
@
11 years ago
Patch seems good to me, but make sure you check the AJAX tests before committing it, as many of them assume POST and I'm not sure if your change will override that.
#3
@
11 years ago
The AJAX tests do indeed pass. They look at DOING_AJAX and the $_POST superglobal, but not the request method.
I've just noticed that Tests_Auth:setUp() explicitly sets $_SERVER['REQUEST_METHOD'] to null, presumably to avoid said PHP notice.
Note: See
TracTickets for help on using
tickets.
32636.patch sets
$_SERVER['REQUEST_METHOD']toGETin the test environment to preventwp_validate_auth_cookie()triggering a PHP notice.All tests remain passing with this change.