diff --git a/tests/phpunit/includes/functions.php b/tests/phpunit/includes/functions.php index cc5469ca4e..d7c2ff47ab 100644 --- a/tests/phpunit/includes/functions.php +++ b/tests/phpunit/includes/functions.php @@ -2,6 +2,8 @@ /** * Retrieves PHPUnit runner version. + * + * @return double The version number. */ function tests_get_phpunit_version() { if ( class_exists( 'PHPUnit_Runner_Version' ) ) { @@ -134,6 +136,13 @@ function _delete_all_posts() { } } +/** + * Handles the WP die handler by outputting the given values as text. + * + * @param string $message The message. + * @param string $title The title. + * @param array $args Array with arguments. + */ function _wp_die_handler( $message, $title = '', $args = array() ) { if ( ! $GLOBALS['_wp_die_disabled'] ) { _wp_die_handler_txt( $message, $title, $args ); @@ -142,22 +151,45 @@ function _wp_die_handler( $message, $title = '', $args = array() ) { } } +/** + * Disables the WP die handler. + */ function _disable_wp_die() { $GLOBALS['_wp_die_disabled'] = true; } +/** + * Enables the WP die handler. + */ function _enable_wp_die() { $GLOBALS['_wp_die_disabled'] = false; } +/** + * Returns the die handler. + * + * @return string The die handler. + */ function _wp_die_handler_filter() { return '_wp_die_handler'; } +/** + * Returns the die handler. + * + * @return string The die handler. + */ function _wp_die_handler_filter_exit() { return '_wp_die_handler_exit'; } +/** + * Dies without an exit. + * + * @param string $message The message. + * @param string $title The title. + * @param array $args Array with arguments. + */ function _wp_die_handler_txt( $message, $title, $args ) { echo "\nwp_die called\n"; echo "Message : $message\n"; @@ -170,6 +202,13 @@ function _wp_die_handler_txt( $message, $title, $args ) { } } +/** + * Dies with an exit. + * + * @param string $message The message. + * @param string $title The title. + * @param array $args Array with arguments. + */ function _wp_die_handler_exit( $message, $title, $args ) { echo "\nwp_die called\n"; echo "Message : $message\n"; @@ -197,6 +236,8 @@ function _set_default_permalink_structure_for_tests() { /** * Helper used with the `upload_dir` filter to remove the /year/month sub directories from the uploads path and URL. + * + * @return array The altered array. */ function _upload_dir_no_subdir( $uploads ) { $subdir = $uploads['subdir']; @@ -210,6 +251,8 @@ function _upload_dir_no_subdir( $uploads ) { /** * Helper used with the `upload_dir` filter to set https upload URL. + * + * @return array The altered array. */ function _upload_dir_https( $uploads ) { $uploads['url'] = str_replace( 'http://', 'https://', $uploads['url'] ); @@ -220,6 +263,8 @@ function _upload_dir_https( $uploads ) { /** * Use the Spy_REST_Server class for the REST server. + * + * @return string The server class name. */ function _wp_rest_server_class_filter() { return 'Spy_REST_Server';