Make WordPress Core


Ignore:
Timestamp:
02/16/2017 11:29:16 PM (6 years ago)
Author:
jnylen0
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php

    r40061 r40065  
    278278            $fixture = $this->normalize_fixture( $data, $route['name'] );
    279279            $mocked_responses .= "\nmockedApiResponse." . $route['name'] . ' = '
    280                 . json_encode( $fixture, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES )
     280                . json_encode( $fixture, JSON_PRETTY_PRINT )
    281281                . ";\n";
    282282        }
Note: See TracChangeset for help on using the changeset viewer.