Opened 10 years ago
Closed 10 years ago
#27749 closed enhancement (fixed)
`wp_die()` should die in plain text when running the test suite
Reported by: | Denis-de-Bernardy | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | 3.9 |
Component: | Build/Test Tools | Keywords: | has-patch |
Focuses: | Cc: |
Description
See:
denis@DB:~/wk/wpdevel $ phpunit PHP Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50536 Library:100010 in /Users/denis/wk/wpdevel/src/wp-includes/wp-db.php on line 1342 PHP Stack trace: PHP 1. {main}() /Users/denis/wk/wpdevel/tests/phpunit/includes/install.php:0 PHP 2. require_once() /Users/denis/wk/wpdevel/tests/phpunit/includes/install.php:20 PHP 3. require_wp_db() /Users/denis/wk/wpdevel/src/wp-settings.php:79 PHP 4. wpdb->__construct() /Users/denis/wk/wpdevel/src/wp-includes/load.php:327 PHP 5. wpdb->db_connect() /Users/denis/wk/wpdevel/src/wp-includes/wp-db.php:604 PHP 6. mysqli_real_connect() /Users/denis/wk/wpdevel/src/wp-includes/wp-db.php:1342 Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50536 Library:100010 in /Users/denis/wk/wpdevel/src/wp-includes/wp-db.php on line 1342 Call Stack: 0.0004 651072 1. {main}() /Users/denis/wk/wpdevel/tests/phpunit/includes/install.php:0 0.0020 815576 2. require_once('/Users/denis/wk/wpdevel/src/wp-settings.php') /Users/denis/wk/wpdevel/tests/phpunit/includes/install.php:20 0.0220 3798264 3. require_wp_db() /Users/denis/wk/wpdevel/src/wp-settings.php:79 0.0256 4336136 4. wpdb->__construct() /Users/denis/wk/wpdevel/src/wp-includes/load.php:327 0.0257 4337184 5. wpdb->db_connect() /Users/denis/wk/wpdevel/src/wp-includes/wp-db.php:604 0.0258 4340872 6. mysqli_real_connect() /Users/denis/wk/wpdevel/src/wp-includes/wp-db.php:1342 <!DOCTYPE html> Boat loads of HTML goes here…
Attachments (1)
Change History (8)
This ticket was mentioned in IRC in #wordpress-dev by jorbin. View the logs.
10 years ago
#5
@
10 years ago
- Keywords has-patch added
The above patch does three things:
1) It re-adds the filter to wp_die_handler
2) It moves all the wp_die_handler related functions into includes/functions.php since that is loaded before wp-settings.php in includes/bootstrap.php
3) it adds a simple text based wp_die_handler.
This makes wp_die much more usable when running the unit tests.
This ticket was mentioned in IRC in #wordpress-dev by jorbin. View the logs.
10 years ago
Note: See
TracTickets for help on using
tickets.
For your own tests, you can create a new wp die handler that doesn't return html by filtering wp_die_handler. You can see an example in https://github.com/post-forking/post-forking/blob/master/tests/wp_die_handler.php
In https://core.trac.wordpress.org/changeset/880/tests/trunk we removed wp-tests.php and that contained a filter for the wp_die_handler (this code still lives in https://core.trac.wordpress.org/browser/tests/trunk/includes/utils.php#L305 but it seems to be unused now)
I think we should re-add the filter for all tests and create a new handler that returns information in plain text.