Make WordPress Core

Ticket #46501: 46501.diff

File 46501.diff, 2.7 KB (added by andizer, 6 years ago)
  • tests/phpunit/includes/functions.php

     
    22
    33/**
    44 * Retrieves PHPUnit runner version.
     5 *
     6 * @return double The version number.
    57 */
    68function tests_get_phpunit_version() {
    79        if ( class_exists( 'PHPUnit_Runner_Version' ) ) {
     
    134136        }
    135137}
    136138
     139/**
     140 * Handles the WP die handler by outputting the given values as a text.
     141 *
     142 * @param string $message The message.
     143 * @param string $title   The title.
     144 * @param array  $args    Array with arguments.
     145 */
    137146function _wp_die_handler( $message, $title = '', $args = array() ) {
    138147        if ( ! $GLOBALS['_wp_die_disabled'] ) {
    139148                _wp_die_handler_txt( $message, $title, $args );
     
    142151        }
    143152}
    144153
     154/**
     155 * Disables the WP die.
     156 */
    145157function _disable_wp_die() {
    146158        $GLOBALS['_wp_die_disabled'] = true;
    147159}
    148160
     161/**
     162 * Enables the WP die.
     163 */
    149164function _enable_wp_die() {
    150165        $GLOBALS['_wp_die_disabled'] = false;
    151166}
    152167
     168/**
     169 * Returns the die handler.
     170 *
     171 * @return string The die handler.
     172 */
    153173function _wp_die_handler_filter() {
    154174        return '_wp_die_handler';
    155175}
    156176
     177/**
     178 * Returns the die handler.
     179 *
     180 * @return string The die handler.
     181 */
    157182function _wp_die_handler_filter_exit() {
    158183        return '_wp_die_handler_exit';
    159184}
    160185
     186/**
     187 * Dies without an exit.
     188 *
     189 * @param string $message The message.
     190 * @param string $title   The title.
     191 * @param array  $args    Array with arguments.
     192 */
    161193function _wp_die_handler_txt( $message, $title, $args ) {
    162194        echo "\nwp_die called\n";
    163195        echo "Message : $message\n";
     
    170202        }
    171203}
    172204
     205/**
     206 * Dies with an exit.
     207 *
     208 * @param string $message The message.
     209 * @param string $title   The title.
     210 * @param array  $args    Array with arguments.
     211 */
    173212function _wp_die_handler_exit( $message, $title, $args ) {
    174213        echo "\nwp_die called\n";
    175214        echo "Message : $message\n";
     
    197236
    198237/**
    199238 * Helper used with the `upload_dir` filter to remove the /year/month sub directories from the uploads path and URL.
     239 *
     240 * @return array The altered array.
    200241 */
    201242function _upload_dir_no_subdir( $uploads ) {
    202243        $subdir = $uploads['subdir'];
     
    210251
    211252/**
    212253 * Helper used with the `upload_dir` filter to set https upload URL.
     254 *
     255 * @return array The altered array.
    213256 */
    214257function _upload_dir_https( $uploads ) {
    215258        $uploads['url']     = str_replace( 'http://', 'https://', $uploads['url'] );
     
    220263
    221264/**
    222265 * Use the Spy_REST_Server class for the REST server.
     266 *
     267 * @return string The server class name.
    223268 */
    224269function _wp_rest_server_class_filter() {
    225270        return 'Spy_REST_Server';