Changeset 14061 for sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-display.php
- Timestamp:
- 09/18/2024 02:32:35 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-display.php
r9884 r14061 75 75 } else { 76 76 $content = ptr_get_template_part( 77 'result-set ',77 'result-set-single', 78 78 array( 79 79 'posts_per_page' => 500, … … 93 93 */ 94 94 public static function render_results( $atts ) { 95 96 $output = '';97 $query_args = array(98 'posts_per_page' => 3,95 $current_user = null; 96 $output = ''; 97 $query_args = array( 98 'posts_per_page' => 20, 99 99 'post_type' => 'result', 100 100 'post_parent' => 0, … … 102 102 'order' => 'DESC', 103 103 ); 104 $paged = isset( $_GET['rpage'] ) ? (int) $_GET['rpage'] : 0;104 $paged = isset( $_GET['rpage'] ) ? (int) $_GET['rpage'] : 0; 105 105 if ( $paged ) { 106 106 $query_args['paged'] = $paged; … … 118 118 } 119 119 $output .= self::get_display_css(); 120 if ( $paged <= 1 ) { 120 121 if ($paged <= 1) { 121 122 $output .= self::get_reporter_avatars(); 122 123 } 124 123 125 $output .= ptr_get_template_part( 124 'result-set', 125 array( 126 'posts_per_page' => 50, 127 'revisions' => $rev_query->posts, 128 ) 126 'result-set-all', 127 array( 128 'revisions' => $rev_query->posts, 129 ) 129 130 ); 131 130 132 ob_start(); 131 133 self::pagination( $rev_query ); … … 143 145 ?> 144 146 <style> 145 a.ptr-status-badge { 146 color: #FFF; 147 .ptr-status-badge { 148 color: #fff !important; 149 text-decoration: none !important; 147 150 display: inline-block; 148 151 padding-left: 8px; … … 153 156 font-weight: normal; 154 157 } 155 a.ptr-status-badge-passed {158 .ptr-status-badge-passed { 156 159 background-color: #39BC00; 157 160 } 158 a.ptr-status-badge-failed {161 .ptr-status-badge-failed { 159 162 background-color: #CD543A; 160 163 } 161 a.ptr-status-badge-errored {164 .ptr-status-badge-errored { 162 165 background-color: #909090; 163 166 } … … 170 173 .pagination-centered ul.pagination li { 171 174 display: inline-block; 175 margin: 0 5px; 172 176 } 173 177 .pagination-centered ul.pagination li a { 174 178 cursor: pointer; 179 } 180 .ptr-test-reporter-table th { 181 text-align: center; 182 } 183 .ptr-test-reporter-table td { 184 text-align: center; 185 } 186 .ptr-test-reporter-table td[colspan] { 187 text-align: left; 175 188 } 176 189 .ptr-test-reporter-list { … … 194 207 margin-top: 6px; 195 208 margin-bottom: 6px; 209 text-transform: none; 196 210 } 197 211 .ptr-test-reporter-list.ptr-test-reporter-inactive li h5.avatar-name { … … 239 253 if ( ! empty( $all_time_reporters ) ) { 240 254 $all_time_reporters = array_map( 'intval', $all_time_reporters ); 241 $output .= '<h4>Registered, but no reports in >25 Revisions</h4>' . PHP_EOL;242 255 $users = get_users( 243 256 array( … … 251 264 } 252 265 } 266 if ( ! empty( $users ) ) { 267 $output .= '<h4>Registered, but no reports in >25 Revisions</h4>' . PHP_EOL; 268 } 253 269 $output .= self::get_user_list( $users, 'inactive' ); 254 270 } … … 293 309 return ''; 294 310 } 295 $minutes = floor( ( (int) $results['time'] / 60 )% 60 );296 $seconds = ( int) $results['time'] % 60;311 $minutes = floor( ( (int) ( $results['time'] / 60 ) )% 60 ); 312 $seconds = ( ( (int) $results['time'] ) % 60 ); 297 313 return "{$minutes}m {$seconds}s"; 298 314 } … … 307 323 $php_version = 'Unknown'; 308 324 $env = get_post_meta( $report_id, 'env', true ); 325 309 326 if ( ! empty( $env['php_version'] ) ) { 310 327 $php_version = 'PHP ' . $env['php_version']; … … 326 343 $mysql_version = $bits[0]; 327 344 } 345 328 346 return $mysql_version; 347 } 348 349 /** 350 * Get the environment name for display 351 * 352 * @param integer $report_id Report ID. 353 * @return string 354 */ 355 public static function get_display_environment_name( $report_id ) { 356 $env_name = get_post_meta( $report_id, 'environment_name', true ); 357 358 if ( ! empty( $env_name ) ) { 359 return esc_html( $env_name ); 360 } 361 362 return 'Unknown'; 363 } 364 365 /** 366 * Get the test reporter's display name. 367 * 368 * @param integer $reporter_id Reporter's user ID. 369 * @return string 370 */ 371 public static function get_display_reporter_name( $reporter_id ) { 372 $reporter = new \WP_User( $reporter_id ); 373 374 if ( empty( $reporter->display_name ) ) { 375 return esc_html( $reporter->display_name ); 376 } 377 378 return $reporter->user_nicename; 329 379 } 330 380
Note: See TracChangeset
for help on using the changeset viewer.