Ticket #44703: 44703.diff
| File 44703.diff, 2.1 KB (added by , 8 years ago) |
|---|
-
tests/phpunit/includes/functions.php
16 16 unset( $_SERVER['HTTPS'] ); 17 17 } 18 18 19 // For adding hooks before loading WP 19 /** 20 * Adds hooks before loading WP. 21 * 22 * @param string $tag The name for the filter to add. 23 * @param Object|array $function_to_add The function/callback to execute on call. 24 * @param int $priority The priority. 25 * @param int $accepted_args The amount of accepted arguments. 26 * 27 * @return bool Always true. 28 */ 20 29 function tests_add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) { 21 30 global $wp_filter; 22 31 … … 32 41 return true; 33 42 } 34 43 44 /** 45 * Generates an unique id based on the given arguments. 46 * 47 * @param string $tag Unused. The name of the filter to build id for. 48 * @param Object|array $function The function to generate id for. 49 * @param int $priority Unused. The priority. 50 * 51 * @return array|string 52 */ 35 53 function _test_filter_build_unique_id( $tag, $function, $priority ) { 36 54 if ( is_string( $function ) ) { 37 55 return $function; … … 38 56 } 39 57 40 58 if ( is_object( $function ) ) { 41 // Closures are currently implemented as objects 59 // Closures are currently implemented as objects. 42 60 $function = array( $function, '' ); 43 61 } else { 44 62 $function = (array) $function; … … 47 65 if ( is_object( $function[0] ) ) { 48 66 return spl_object_hash( $function[0] ) . $function[1]; 49 67 } elseif ( is_string( $function[0] ) ) { 50 // Static Calling 68 // Static Calling. 51 69 return $function[0] . $function[1]; 52 70 } 53 71 } 54 72 73 /** 74 * Deletes all data from the database 75 * 76 * @return void 77 */ 55 78 function _delete_all_data() { 56 79 global $wpdb; 57 80 … … 79 102 $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id != 1" ); 80 103 } 81 104 105 /** 106 * Deletes all the posts from the database. 107 * 108 * @return void 109 */ 82 110 function _delete_all_posts() { 83 111 global $wpdb; 84 112