Making WordPress.org


Ignore:
Timestamp:
09/18/2024 02:32:35 AM (4 months ago)
Author:
dd32
Message:

Make: PHPUnit Test Reporter: Update to v0.2 from GitHub:
https://github.com/WordPress/phpunit-test-reporter/releases/tag/v0.2.0

Props desrosj.
Fixes #7777.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/phpunit-test-reporter.php

    r11328 r14061  
    88 * Text Domain:     ptr
    99 * Domain Path:     /languages
    10  * Version:         0.1.3
     10 * Version:         0.2.0
    1111 * License:         GPL v3
    1212 *
     
    3030add_action( 'the_content', array( 'PTR\Display', 'filter_the_content' ) );
    3131add_action( 'rest_api_init', array( 'PTR\RestAPI', 'register_routes' ) );
    32 
    3332add_action( 'load-edit.php', 'ptr_load_edit_php' );
    3433
     
    9493    return ob_get_clean();
    9594}
     95
     96/**
     97 * Counts the number of failing or passing test reports for a revision.
     98 *
     99 * @param int    $revision_parent_id The current revision's post ID.
     100 * @param string $status             The status term slug to count.
     101 *
     102 * @return int The number of reports for the given revision.
     103 */
     104function ptr_count_test_results( $revision_parent_id, $status = 'passed' ) {
     105    $report_query = new WP_Query(
     106        array(
     107            'post_type'      => 'result',
     108            'post_parent'    => $revision_parent_id,
     109            'fields'         => 'ids',
     110            'posts_per_page' => 1,
     111            'tax_query'      => array(
     112                array(
     113                    'taxonomy'   => 'report-result',
     114                    'terms'      => $status,
     115                    'field'      => 'slug',
     116                ),
     117            )
     118        )
     119    );
     120
     121    if ( ! $report_query->have_posts() ) {
     122        return 0;
     123    }
     124
     125    return $report_query->found_posts;
     126}
Note: See TracChangeset for help on using the changeset viewer.