REST API: Fix the client test fixture generation in PHP 5.2 and 5.3.

Remove `JSON_UNESCAPED_SLASHES` from the `wp_json_encode` call - this constant is not supported in PHP < 5.4, and we don't polyfill it either.

Also make the PHPUnit test suite correctly exit with a non-zero exit code when `wp-tests-config.php` is not present.  This was causing `grunt restapi-jsclient` to incorrectly proceed to its second step even when the first step failed with this error.

Props ocean90.
Fixes #39264.


git-svn-id: https://develop.svn.wordpress.org/trunk@40065 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
James Nylen
2017-02-16 23:29:16 +00:00
parent a01edcf0a6
commit 9d96b31b90
3 changed files with 214 additions and 213 deletions

View File

@@ -18,8 +18,9 @@ $config_file_path .= '/wp-tests-config.php';
*/
global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer, $wp_theme_directories;
if ( !is_readable( $config_file_path ) ) {
die( "ERROR: wp-tests-config.php is missing! Please use wp-tests-config-sample.php to create a config file.\n" );
if ( ! is_readable( $config_file_path ) ) {
echo "ERROR: wp-tests-config.php is missing! Please use wp-tests-config-sample.php to create a config file.\n";
exit( 1 );
}
require_once $config_file_path;
require_once dirname( __FILE__ ) . '/functions.php';