REST API: Skip generating the client test fixtures in PHP 5.2 and 5.3.
Follow-up to [40065] - `JSON_*` constants are differently unsupported in PHP 5.2 and 5.3, which caused other, more different failures. Also bring back `JSON_UNESCAPED_SLASHES` because the generated output looks nicer this way. Fixes #39264. git-svn-id: https://develop.svn.wordpress.org/trunk@40066 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9d96b31b90
commit
900c67ed46
@ -275,15 +275,21 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
|
|||||||
|
|
||||||
$this->assertTrue( ! empty( $data ), $route['name'] . ' route should return data.' );
|
$this->assertTrue( ! empty( $data ), $route['name'] . ' route should return data.' );
|
||||||
|
|
||||||
$fixture = $this->normalize_fixture( $data, $route['name'] );
|
if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) {
|
||||||
$mocked_responses .= "\nmockedApiResponse." . $route['name'] . ' = '
|
$fixture = $this->normalize_fixture( $data, $route['name'] );
|
||||||
. json_encode( $fixture, JSON_PRETTY_PRINT )
|
$mocked_responses .= "\nmockedApiResponse." . $route['name'] . ' = '
|
||||||
. ";\n";
|
. json_encode( $fixture, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES )
|
||||||
|
. ";\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the route object for QUnit tests.
|
if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
||||||
$file = './tests/qunit/fixtures/wp-api-generated.js';
|
echo "Skipping generation of API client fixtures due to unsupported JSON_* constants.\n";
|
||||||
file_put_contents( $file, $mocked_responses );
|
} else {
|
||||||
|
// Save the route object for QUnit tests.
|
||||||
|
$file = './tests/qunit/fixtures/wp-api-generated.js';
|
||||||
|
file_put_contents( $file, $mocked_responses );
|
||||||
|
}
|
||||||
|
|
||||||
// Clean up our test data.
|
// Clean up our test data.
|
||||||
wp_delete_post( $post_id, true );
|
wp_delete_post( $post_id, true );
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user