<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[14061] sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter: Make: PHPUnit Test Reporter: Update to v0.2 from GitHub:</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/14061">14061</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/14061","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dd32</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-09-18 02:32:35 +0000 (Wed, 18 Sep 2024)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>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 <a href="http://meta.trac.wordpress.org/ticket/7777">#7777</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterpartssingleresultphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/single-result.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterphpunittestreporterphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/phpunit-test-reporter.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterreadmetxt">sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/readme.txt</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreportersrcclasscontentmodelphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-content-model.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreportersrcclassdisplayphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-display.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreportersrcclassrestapiphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-restapi.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterpartsresultsetallphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set-all.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterpartsresultsetsinglephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set-single.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterpartsresultsetphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterpartsresultsetallphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set-all.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set-all.php                           (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set-all.php     2024-09-18 02:32:35 UTC (rev 14061)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,50 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+use PTR\Display;
+
+echo Display::get_display_css(); ?>
+
+<table class="ptr-test-reporter-table alignwide">
+       <thead>
+               <tr>
+                       <th style="width:100px">Revision</th>
+                       <th style="width:100px">Passed</th>
+                       <th style="width:100px">Failed</th>
+                       <th style="width:100px">➡️</th>
+               </tr>
+       </thead>
+       <tbody>
+               <?php
+               foreach ( $revisions as $revision ) :
+                       $rev_id = (int) ltrim( $revision->post_name, 'r' );
+
+                       $num_passed = ptr_count_test_results( $revision->ID );
+                       $num_failed = ptr_count_test_results( $revision->ID, 'failed' );
+                       ?>
+                       <tr>
+                               <td>
+          <a
+            href="<?php echo esc_url( sprintf( 'https://core.trac.wordpress.org/changeset/%d', $rev_id ) ); ?>"
+            title="<?php echo esc_attr( apply_filters( 'the_title', $revision->post_title ) ); ?>">
+            r<?php echo $rev_id; ?>
+          </a>
+        </td>
+
+        <td>
+            <span class="ptr-status-badge ptr-status-badge-passed">
+                               <?php echo $num_passed; ?>
+            </span>
+        </td>
+        <td>
+            <span class="ptr-status-badge ptr-status-badge-failed">
+                               <?php echo $num_failed; ?>
+            </span>
+        </td>
+        <td>
+          <a href="<?php the_permalink( $revision->ID ); ?>">
+            View
+          </a>
+        </td>
+                       </tr>
+               <?php endforeach; ?>
+       </tbody>
+</table>
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set-all.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterpartsresultsetsinglephpfromrev14060sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterpartsresultsetphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set-single.php (from rev 14060, sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set-single.php                                (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set-single.php  2024-09-18 02:32:35 UTC (rev 14061)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,113 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+use PTR\Display;
+
+echo Display::get_display_css();
+
+foreach ( $revisions as $revision ) :
+
+  $rev_id = (int) ltrim( $revision->post_name, 'r' );
+?>
+
+<div class="ptr-test-reporter-single-revision">
+       <a href="<?php echo esc_url( sprintf( 'https://core.trac.wordpress.org/changeset/%d', $rev_id ) ); ?>">
+               r<?php echo $rev_id; ?>
+       </a>: <?php echo esc_attr( apply_filters( 'the_title', $revision->post_title ) ); ?>
+</div>
+
+<table class="ptr-test-reporter-table alignwide">
+       <thead>
+               <tr>
+                       <th style="width:100px">Status</th>
+                       <th style="width:150px">PHP Version</th>
+                       <th>Database Version</th>
+               </tr>
+       </thead>
+       <tbody>
+
+                       <?php
+                       $query_args = array(
+                               'posts_per_page' => $posts_per_page,
+                               'author'         => $post_author ?? null,
+                               'post_type'      => 'result',
+                               'post_parent'    => $revision->ID,
+                               'orderby'        => [ 'author' => 'ASC', 'env_name_clause' => 'ASC' ],
+                               'meta_query'     => array(
+                                       'relation' => 'OR',
+                                       'env_name_clause' => array(
+                                               'key'     => 'environment_name',
+                                               'compare' => 'EXISTS',
+                                       ),
+                                       array(
+                                               'key'     => 'environment_name',
+                                               'compare' => 'NOT EXISTS',
+                                       )
+                               ),
+                       );
+                       $report_query = new WP_Query( $query_args );
+                       if ( ! empty( $report_query->posts ) ) :
+
+          $prev_author = null;
+
+                               foreach ( $report_query->posts as $report ) :
+                                       $status       = 'Errored';
+                                       $status_title = 'No results found for test.';
+                                       $results      = get_post_meta( $report->ID, 'results', true );
+                                       if ( isset( $results['failures'] ) && ! empty( $results['tests'] ) ) {
+                                               $status       = 0 === (int) $results['failures'] && 0 === (int) $results['errors'] ? 'Passed' : 'Failed';
+                                               $status_title = (int) $results['tests'] . ' tests, ' . (int) $results['failures'] . ' failed, ' . (int) $results['errors'] . ' errors';
+                                       }
+                                       $host = 'Unknown';
+                                       $user = get_user_by( 'id', $report->post_author );
+                                       if ( $user ) {
+                                               $host = '';
+                                               if ( ! empty( $user->user_url ) ) {
+                                                       $host .= '<a target="_blank" rel="nofollow" href="' . esc_url( $user->user_url ) . '">';
+                                               }
+                                               $host .= get_avatar(
+                                                       $user->ID,
+                                                       18,
+                                                       '',
+                                                       '',
+                                                       array(
+                                                               'extra_attr' => 'style="vertical-align: middle;margin-right:5px;"',
+                                                       )
+                                               );
+
+                                               $host .= Display::get_display_reporter_name( $report->post_author );
+
+                                               if ( ! empty( $user->user_url ) ) {
+                                                       $host .= '</a>';
+                                               }
+                                       }
+                                       ?>
+        <?php if ( $prev_author !== $host ): ?>
+          <tr>
+            <td colspan="3">
+              <?php echo wp_kses_post( $host ); ?>
+            </td>
+          </tr>
+
+        <?php endif; ?>
+                               <tr>
+                                       <td>
+                                               <a href="<?php echo esc_url( get_permalink( $report->ID ) ); ?>" title="<?php echo esc_attr( $status_title ); ?>" class="<?php echo esc_attr( 'ptr-status-badge ptr-status-badge-' . strtolower( $status ) ); ?>">
+                                                       <?php echo esc_html( $status ); ?>
+                                               </a>
+                                       </td>
+                                       <td><?php echo esc_html( Display::get_display_php_version( $report->ID ) ); ?></td>
+                                       <td><?php echo esc_html( Display::get_display_mysql_version( $report->ID ) ); ?></td>
+                               </tr>
+                                       <?php
+                           $prev_author = $host;
+                               endforeach;
+                       else :
+                               ?>
+                               <tr>
+                                       <td colspan="3">
+                                               No reports for changeset.
+                                       </td>
+                               </tr>
+                       <?php endif; ?>
+       </tbody>
+</table>
+<?php endforeach;
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterpartsresultsetphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set.php       2024-09-17 16:03:18 UTC (rev 14060)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set.php 2024-09-18 02:32:35 UTC (rev 14061)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,89 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-use PTR\Display;
-
-echo Display::get_display_css(); ?>
-
-<table>
-       <thead>
-               <tr>
-                       <th style="width:100px">Revision</th>
-                       <th>Host</th>
-                       <th>PHP Version</th>
-                       <th>Database Version</th>
-               </tr>
-       </thead>
-       <tbody>
-               <?php
-               $total_cols = 5;
-               foreach ( $revisions as $revision ) :
-                       $rev_id = (int) ltrim( $revision->post_name, 'r' );
-                       ?>
-                       <tr>
-                               <th colspan="<?php echo (int) $total_cols; ?>"><a href="<?php echo esc_url( sprintf( 'https://core.trac.wordpress.org/changeset/%d', $rev_id ) ); ?>">r<?php echo (int) $rev_id; ?></a>: <?php echo wp_kses_post( apply_filters( 'the_title', $revision->post_title ) ); ?></th>
-                       </tr>
-                       <?php
-                       $query_args   = array(
-                               'posts_per_page' => $posts_per_page,
-                               'post_type'      => 'result',
-                               'post_parent'    => $revision->ID,
-                               'orderby'        => 'post_title',
-                               'order'          => 'ASC',
-                       );
-                       $report_query = new WP_Query( $query_args );
-                       if ( ! empty( $report_query->posts ) ) :
-                               foreach ( $report_query->posts as $report ) :
-                                       $status       = 'Errored';
-                                       $status_title = 'No results found for test.';
-                                       $results      = get_post_meta( $report->ID, 'results', true );
-                                       if ( isset( $results['failures'] ) && ! empty( $results['tests'] ) ) {
-                                               $status       = 0 === (int) $results['failures'] && 0 === (int) $results['errors'] ? 'Passed' : 'Failed';
-                                               $status_title = (int) $results['tests'] . ' tests, ' . (int) $results['failures'] . ' failed, ' . (int) $results['errors'] . ' errors';
-                                       }
-                                       $host = 'Unknown';
-                                       $user = get_user_by( 'id', $report->post_author );
-                                       if ( $user ) {
-                                               $host = '';
-                                               if ( ! empty( $user->user_url ) ) {
-                                                       $host .= '<a target="_blank" rel="nofollow" href="' . esc_url( $user->user_url ) . '">';
-                                               }
-                                               $host .= get_avatar(
-                                                       $user->ID,
-                                                       18,
-                                                       '',
-                                                       '',
-                                                       array(
-                                                               'extra_attr' => 'style="vertical-align: middle;margin-right:5px;"',
-                                                       )
-                                               );
-                                               if ( ! empty( $user->user_url ) ) {
-                                                       $host .= '</a>';
-                                               }
-                                               if ( ! empty( $user->user_url ) ) {
-                                                       $host .= '<a target="_blank" rel="nofollow" href="' . esc_url( $user->user_url ) . '">';
-                                               }
-                                               $host .= $user->display_name;
-                                               if ( ! empty( $user->user_url ) ) {
-                                                       $host .= '</a>';
-                                               }
-                                       }
-                                       ?>
-                               <tr>
-                                       <td><a href="<?php echo esc_url( get_permalink( $report->ID ) ); ?>" title="<?php echo esc_attr( $status_title ); ?>" class="<?php echo esc_attr( 'ptr-status-badge ptr-status-badge-' . strtolower( $status ) ); ?>"><?php echo esc_html( $status ); ?></a></td>
-                                       <td><?php echo wp_kses_post( $host ); ?></td>
-                                       <td><?php echo esc_html( Display::get_display_php_version( $report->ID ) ); ?></td>
-                                       <td><?php echo esc_html( Display::get_display_mysql_version( $report->ID ) ); ?></td>
-                               </tr>
-                                       <?php
-                               endforeach;
-                       else :
-                               ?>
-                               <tr>
-                                       <td></td>
-                                       <td colspan="<?php echo (int) $total_cols - 1; ?>">
-                                               No reports for changeset.
-                                       </td>
-                               </tr>
-                       <?php endif; ?>
-               <?php endforeach; ?>
-       </tbody>
-</table>
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterpartssingleresultphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/single-result.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/single-result.php    2024-09-17 16:03:18 UTC (rev 14060)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/single-result.php      2024-09-18 02:32:35 UTC (rev 14061)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,12 +24,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'extra_attr' => 'style="vertical-align: middle;margin-right:5px;"',
</span><span class="cx" style="display: block; padding: 0 10px">                )
</span><span class="cx" style="display: block; padding: 0 10px">        );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( ! empty( $user->user_url ) ) {
-               $host .= '</a>';
-       }
-       if ( ! empty( $user->user_url ) ) {
-               $host .= '<a target="_blank" rel="nofollow" href="' . esc_url( $user->user_url ) . '">';
-       }
</del><span class="cx" style="display: block; padding: 0 10px">         $host .= $user->display_name;
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! empty( $user->user_url ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $host .= '</a>';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -55,6 +49,25 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <td><?php echo wp_kses_post( $host ); ?></td>
</span><span class="cx" style="display: block; padding: 0 10px">        </tr>
</span><span class="cx" style="display: block; padding: 0 10px">        <tr>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                <td><strong>Test Date</strong></td>
+               <td>
+                       <?php the_date(); ?>
+                       <?php the_time(); ?>
+               </td>
+       </tr>
+       <tr>
+               <td><strong>Execution Time</strong></td>
+               <td>
+                       <?php echo esc_html( Display::get_display_time( $report->ID ) ); ?>
+               </td>
+       </tr>
+       <tr>
+               <td><strong>Environment Name</strong></td>
+               <td>
+                       <?php echo esc_html( Display::get_display_environment_name( $report->ID ) ); ?>
+               </td>
+       </tr>
+       <tr>
</ins><span class="cx" style="display: block; padding: 0 10px">                 <td><strong>PHP Version</strong></td>
</span><span class="cx" style="display: block; padding: 0 10px">                <td><?php echo esc_html( Display::get_display_php_version( $report->ID ) ); ?></td>
</span><span class="cx" style="display: block; padding: 0 10px">        </tr>
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterphpunittestreporterphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/phpunit-test-reporter.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/phpunit-test-reporter.php  2024-09-17 16:03:18 UTC (rev 14060)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/phpunit-test-reporter.php    2024-09-18 02:32:35 UTC (rev 14061)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,7 +7,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * Author URI:      https://make.wordpress.org/hosting/
</span><span class="cx" style="display: block; padding: 0 10px">  * Text Domain:     ptr
</span><span class="cx" style="display: block; padding: 0 10px">  * Domain Path:     /languages
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Version:         0.1.3
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Version:         0.2.0
</ins><span class="cx" style="display: block; padding: 0 10px">  * License:         GPL v3
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @package         PTR
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,7 +29,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'post_class', array( 'PTR\Display', 'filter_post_class' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'the_content', array( 'PTR\Display', 'filter_the_content' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'rest_api_init', array( 'PTR\RestAPI', 'register_routes' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> add_action( 'load-edit.php', 'ptr_load_edit_php' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -93,3 +92,35 @@
</span><span class="cx" style="display: block; padding: 0 10px">        include $full_path;
</span><span class="cx" style="display: block; padding: 0 10px">        return ob_get_clean();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Counts the number of failing or passing test reports for a revision.
+ *
+ * @param int    $revision_parent_id The current revision's post ID.
+ * @param string $status             The status term slug to count.
+ *
+ * @return int The number of reports for the given revision.
+ */
+function ptr_count_test_results( $revision_parent_id, $status = 'passed' ) {
+       $report_query = new WP_Query(
+               array(
+                       'post_type'      => 'result',
+                       'post_parent'    => $revision_parent_id,
+                       'fields'         => 'ids',
+                       'posts_per_page' => 1,
+                       'tax_query'      => array(
+                               array(
+                                       'taxonomy'   => 'report-result',
+                                       'terms'      => $status,
+                                       'field'      => 'slug',
+                               ),
+                       )
+               )
+       );
+
+       if ( ! $report_query->have_posts() ) {
+               return 0;
+       }
+
+       return $report_query->found_posts;
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreporterreadmetxt"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/readme.txt</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/readme.txt 2024-09-17 16:03:18 UTC (rev 14060)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/readme.txt   2024-09-18 02:32:35 UTC (rev 14061)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,9 +1,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> === PHPUnit Test Reporter ===
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Contributors: octalmage, danielbachhuber, wpamitkumar, mikeschroder, pfefferle
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Contributors: octalmage, danielbachhuber, wpamitkumar, kirasong, pfefferle, desrosj, crixu
</ins><span class="cx" style="display: block; padding: 0 10px"> Tags: phpunit
</span><span class="cx" style="display: block; padding: 0 10px"> Requires at least: 4.7
</span><span class="cx" style="display: block; padding: 0 10px"> Tested up to: 5.5
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Stable tag: 0.1.3
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Stable tag: 0.2.0
</ins><span class="cx" style="display: block; padding: 0 10px"> License: GPLv3
</span><span class="cx" style="display: block; padding: 0 10px"> License URI: http://www.gnu.org/licenses/gpl-3.0.html
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -44,3 +44,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> = 0.1.3 (September 23th, 2020) =
</span><span class="cx" style="display: block; padding: 0 10px"> * Include errors along with failures on the error report page ([PR](https://github.com/WordPress/phpunit-test-reporter/pull/84)).
</span><span class="cx" style="display: block; padding: 0 10px"> * Change to `integer` built-in type for `commit` field, following updates in WordPress 5.5.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+
+= 0.2.0 (September 17th, 2024) =
+* Prevent invalid HTML markup on test result pages.
+* Add a custom Post_List_Table for the results post type that lacks inline edit/quick edit.
+* Don't use _get_list_table() as that create the object and triggers some queries. Including the file directly works just as well.
+* Allow for multiple reports per commit for the same test bot.
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreportersrcclasscontentmodelphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-content-model.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-content-model.php        2024-09-17 16:03:18 UTC (rev 14060)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-content-model.php  2024-09-18 02:32:35 UTC (rev 14061)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,6 +42,60 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               register_taxonomy(
+                       'php-version',
+                       array( 'result' ),
+                       array(
+                               'labels'       => array(
+                                       'name'          => __( 'PHP Versions', 'ptr' ),
+                                       'singular_name' => __( 'PHP Version', 'ptr' ),
+                               ),
+                               'hierarchical'               => false,
+                               'public'                     => false,
+                               'show_ui'                    => true,
+                               'show_admin_column'          => true,
+                               'show_in_nav_menus'          => false,
+                               'show_tagcloud'              => false,
+                               'show_in_rest'               => true,
+                       )
+               );
+
+               register_taxonomy(
+                       'db-version',
+                       array( 'result' ),
+                       array(
+                               'labels'       => array(
+                                       'name'          => __( 'Database Versions', 'ptr' ),
+                                       'singular_name' => __( 'Database Version', 'ptr' ),
+                               ),
+                               'hierarchical'               => false,
+                               'public'                     => false,
+                               'show_ui'                    => true,
+                               'show_admin_column'          => true,
+                               'show_in_nav_menus'          => false,
+                               'show_tagcloud'              => false,
+                               'show_in_rest'               => true,
+                       )
+               );
+
+               register_taxonomy(
+                       'report-result',
+                       array( 'result' ),
+                       array(
+                               'labels'       => array(
+                                       'name'          => __( 'Result Status', 'ptr' ),
+                                       'singular_name' => __( 'Result Status', 'ptr' ),
+                               ),
+                               'hierarchical'               => false,
+                               'public'                     => false,
+                               'show_ui'                    => true,
+                               'show_admin_column'          => true,
+                               'show_in_nav_menus'          => false,
+                               'show_tagcloud'              => false,
+                               'show_in_rest'               => true,
+                       )
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreportersrcclassdisplayphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-display.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-display.php      2024-09-17 16:03:18 UTC (rev 14060)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-display.php        2024-09-18 02:32:35 UTC (rev 14061)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -74,7 +74,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px">                } else {
</span><span class="cx" style="display: block; padding: 0 10px">                        $content = ptr_get_template_part(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'result-set',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'result-set-single',
</ins><span class="cx" style="display: block; padding: 0 10px">                                 array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'posts_per_page' => 500,
</span><span class="cx" style="display: block; padding: 0 10px">                                        'revisions'      => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -92,16 +92,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * Render the test results.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public static function render_results( $atts ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-               $output     = '';
-               $query_args = array(
-                       'posts_per_page' => 3,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $current_user = null;
+               $output       = '';
+               $query_args   = array(
+                       'posts_per_page' => 20,
</ins><span class="cx" style="display: block; padding: 0 10px">                         'post_type'      => 'result',
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_parent'    => 0,
</span><span class="cx" style="display: block; padding: 0 10px">                        'orderby'        => 'post_name',
</span><span class="cx" style="display: block; padding: 0 10px">                        'order'          => 'DESC',
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $paged      = isset( $_GET['rpage'] ) ? (int) $_GET['rpage'] : 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $paged        = isset( $_GET['rpage'] ) ? (int) $_GET['rpage'] : 0;
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( $paged ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $query_args['paged'] = $paged;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -117,16 +117,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return $output;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">                $output .= self::get_display_css();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $paged <= 1 ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               if ($paged <= 1) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $output .= self::get_reporter_avatars();
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $output .= ptr_get_template_part(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'result-set',
-                       array(
-                               'posts_per_page' => 50,
-                               'revisions'      => $rev_query->posts,
-                       )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'result-set-all',
+                               array(
+                                               'revisions' => $rev_query->posts,
+                               )
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 ob_start();
</span><span class="cx" style="display: block; padding: 0 10px">                self::pagination( $rev_query );
</span><span class="cx" style="display: block; padding: 0 10px">                $output .= ob_get_clean();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -142,8 +144,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                ob_start();
</span><span class="cx" style="display: block; padding: 0 10px">                ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <style>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        a.ptr-status-badge {
-                               color: #FFF;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 .ptr-status-badge {
+                               color: #fff !important;
+                               text-decoration: none !important;
</ins><span class="cx" style="display: block; padding: 0 10px">                                 display: inline-block;
</span><span class="cx" style="display: block; padding: 0 10px">                                padding-left: 8px;
</span><span class="cx" style="display: block; padding: 0 10px">                                padding-right: 8px;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -152,13 +155,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                border-radius: 3px;
</span><span class="cx" style="display: block; padding: 0 10px">                                font-weight: normal;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        a.ptr-status-badge-passed {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 .ptr-status-badge-passed {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 background-color: #39BC00;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        a.ptr-status-badge-failed {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 .ptr-status-badge-failed {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 background-color: #CD543A;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        a.ptr-status-badge-errored {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 .ptr-status-badge-errored {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 background-color: #909090;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                        .pagination-centered {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -169,10 +172,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                        .pagination-centered ul.pagination li {
</span><span class="cx" style="display: block; padding: 0 10px">                                display: inline-block;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                margin: 0 5px;
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                        .pagination-centered ul.pagination li a {
</span><span class="cx" style="display: block; padding: 0 10px">                                cursor: pointer;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        .ptr-test-reporter-table th {
+                               text-align: center;
+                       }
+                       .ptr-test-reporter-table td {
+                               text-align: center;
+                       }
+                       .ptr-test-reporter-table td[colspan] {
+                               text-align: left;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                         .ptr-test-reporter-list {
</span><span class="cx" style="display: block; padding: 0 10px">                                list-style-type: none;
</span><span class="cx" style="display: block; padding: 0 10px">                                margin-left: 0;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -193,6 +206,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                font-weight: 600;
</span><span class="cx" style="display: block; padding: 0 10px">                                margin-top: 6px;
</span><span class="cx" style="display: block; padding: 0 10px">                                margin-bottom: 6px;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                text-transform: none;
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                        .ptr-test-reporter-list.ptr-test-reporter-inactive li h5.avatar-name {
</span><span class="cx" style="display: block; padding: 0 10px">                                font-size: 11px;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -238,7 +252,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $all_time_reporters = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type='result' AND post_status='publish' AND post_parent != 0" ); // @codingStandardsIgnoreLine
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! empty( $all_time_reporters ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $all_time_reporters = array_map( 'intval', $all_time_reporters );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $output            .= '<h4>Registered, but no reports in >25 Revisions</h4>' . PHP_EOL;
</del><span class="cx" style="display: block; padding: 0 10px">                         $users              = get_users(
</span><span class="cx" style="display: block; padding: 0 10px">                                array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'orderby' => 'display_name',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -250,6 +263,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        unset( $users[ $i ] );
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        if ( ! empty( $users ) ) {
+                               $output .= '<h4>Registered, but no reports in >25 Revisions</h4>' . PHP_EOL;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                         $output .= self::get_user_list( $users, 'inactive' );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">                return $output;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -292,8 +308,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                if ( empty( $results['time'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return '';
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $minutes = floor( ( (int) $results['time'] / 60 ) % 60 );
-               $seconds = (int) $results['time'] % 60;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $minutes = floor( ( (int) ( $results['time'] / 60 ) )% 60 );
+               $seconds = ( ( (int) $results['time'] ) % 60 );
</ins><span class="cx" style="display: block; padding: 0 10px">                 return "{$minutes}m {$seconds}s";
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -306,6 +322,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public static function get_display_php_version( $report_id ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $php_version = 'Unknown';
</span><span class="cx" style="display: block; padding: 0 10px">                $env         = get_post_meta( $report_id, 'env', true );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( ! empty( $env['php_version'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $php_version = 'PHP ' . $env['php_version'];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -325,10 +342,43 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $bits          = explode( ',', $env['mysql_version'] );
</span><span class="cx" style="display: block; padding: 0 10px">                        $mysql_version = $bits[0];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $mysql_version;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Get the environment name for display
+        *
+        * @param integer $report_id Report ID.
+        * @return string
+        */
+       public static function get_display_environment_name( $report_id ) {
+               $env_name = get_post_meta( $report_id, 'environment_name', true );
+
+               if ( ! empty( $env_name ) ) {
+                       return esc_html( $env_name );
+               }
+
+               return 'Unknown';
+       }
+
+       /**
+        * Get the test reporter's display name.
+        *
+        * @param integer $reporter_id Reporter's user ID.
+        * @return string
+        */
+       public static function get_display_reporter_name( $reporter_id ) {
+               $reporter = new \WP_User( $reporter_id );
+
+               if ( empty( $reporter->display_name ) ) {
+                       return esc_html( $reporter->display_name );
+               }
+
+               return $reporter->user_nicename;
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Get the extensions list for display
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param integer $report_id Report ID.
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsphpunittestreportersrcclassrestapiphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-restapi.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-restapi.php      2024-09-17 16:03:18 UTC (rev 14060)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-restapi.php        2024-09-18 02:32:35 UTC (rev 14061)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -113,22 +113,76 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $env = isset( $parameters['env'] ) ? json_decode( $parameters['env'], true ) : array();
+
+               $php_version = '';
+               if ( isset( $env['php_version'] ) ) {
+                       $parts = explode( '.', $env['php_version'] );
+                       $php_version = $parts[0] . '.' . $parts[1];
+               }
+
+               $db_version = ! empty( $parameters['mysql_version'] ) ? $parameters['mysql_version'] : 'Unknown';
+               $env_name   = ! empty( $env['label'] ) ? wp_kses( $env['label'], [] ) : '';
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $current_user = wp_get_current_user();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $tax_query    = [
+                       'relation' => 'AND',
+               ];
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $args = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $php_version ) {
+                       $tax_query[] = array(
+                               'taxonomy' => 'php-version',
+                               'terms'    => [ $php_version ],
+                               'field'    => 'name',
+                       );
+               }
+
+               if ( $db_version ) {
+                       $tax_query[] = array(
+                               'taxonomy' => 'db-version',
+                               'terms'    => [ $db_version ],
+                               'field'    => 'name',
+                       );
+               }
+
+               $meta_query = [];
+
+               if ( $env_name ) {
+                       $meta_query[] = array(
+                               'key'   => 'environment_name',
+                               'value' => $env_name,
+                       );
+               }
+
+               // Check to see if the test result already exist.
+               $results = get_posts( array(
</ins><span class="cx" style="display: block; padding: 0 10px">                         'post_parent' => $parent_id,
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_type'   => 'result',
</span><span class="cx" style="display: block; padding: 0 10px">                        'numberposts' => 1,
</span><span class="cx" style="display: block; padding: 0 10px">                        'author'      => $current_user->ID,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tax_query'   => $tax_query,
+                       'meta_query'  => $meta_query,
+               ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Check to see if the test result already exist.
-               $results = get_posts( $args );
</del><span class="cx" style="display: block; padding: 0 10px">                 if ( $results ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $post_id = $results[0]->ID;
</span><span class="cx" style="display: block; padding: 0 10px">                } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $results = array(
-                               'post_title'   => $current_user->user_login . ' - ' . $slug,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $post_title = $current_user->user_login . ' - ' . $slug;
+
+                       if ( $env_name ) {
+                               $post_title .= ' - ' . $env_name;
+                       }
+
+                       if ( $php_version ) {
+                               $post_title .= ' - ' . $php_version;
+                       }
+
+                       if ( $db_version ) {
+                               $post_title .= ' - ' . $db_version;
+                       }
+
+                       $args = array(
+                               'post_title'   => $post_title,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'post_content' => '',
</span><span class="cx" style="display: block; padding: 0 10px">                                'post_status'  => 'publish',
</span><span class="cx" style="display: block; padding: 0 10px">                                'post_author'  => $current_user->ID,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -137,7 +191,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Store the results.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $post_id = wp_insert_post( $results, true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $post_id = wp_insert_post( $args, true );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( is_wp_error( $post_id ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -144,12 +198,28 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return $post_id;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                wp_set_object_terms( $post_id, array( $php_version ), 'php-version' );
+               wp_set_object_terms( $post_id, array( $db_version ), 'db-version' );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $env     = isset( $parameters['env'] ) ? json_decode( $parameters['env'], true ) : array();
</span><span class="cx" style="display: block; padding: 0 10px">                $results = isset( $parameters['results'] ) ? json_decode( $parameters['results'], true ) : array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                update_post_meta( $post_id, 'env', $env );
</span><span class="cx" style="display: block; padding: 0 10px">                update_post_meta( $post_id, 'results', $results );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                update_post_meta( $post_id, 'environment_name', $env_name );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $outcome = 'Unknown';
+
+               if ( ! empty( $results['failures'] ) ) {
+                       $outcome = 'Failed';
+               } elseif ( ! empty( $results['errors'] ) ) {
+                       $outcome = 'Errored';
+               } else {
+                       $outcome = 'Passed';
+               }
+
+               wp_set_object_terms( $post_id, $outcome, 'report-result' );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 self::maybe_send_email_notifications( $parent_id );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Create the response object.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -168,6 +238,92 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return $response;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        private static function get_new_failures( $post_id ) {
+               $p         = get_post( $post_id );
+               $parent_id = $p->post_parent;
+
+               $post_terms = wp_get_object_terms( $post_id, array( 'php-version', 'db-version' ) );
+
+               if ( is_wp_error( $post_terms ) ) {
+                       return [];
+               }
+
+               $tax_query  = [];
+               $meta_query = [];
+
+               foreach ( $post_terms as $term ) {
+                       if ( 'php-version' === $term['taxonomy'] ) {
+                               $tax_query[] = array(
+                                       'taxonomy' => 'php-version',
+                                       'terms'    => [ $term['term_id'] ],
+                               );
+                       }
+
+                       if ( 'db-version' === $term['taxonomy'] ) {
+                               $tax_query[] = array(
+                                       'taxonomy' => 'db-version',
+                                       'terms'    => [ $term['term_id'] ],
+                               );
+                       }
+               }
+
+               $env_name = get_post_meta( $post_id, 'environment_name', true );
+
+               if ( ! empty( $env_name ) ) {
+                       $meta_query [] = array(
+                               'key'   => 'environment_name',
+                               'value' => $env_name,
+                       );
+               }
+
+               $previous_results = get_posts( array(
+                       'post_parent__not_in' => [ $parent_id ],
+                       'post_type'           => 'result',
+                       'numberposts'         => 1,
+                       'author'              => $p->post_author,
+                       'tax_query'           => $tax_query,
+                       'meta_query'          => $meta_query,
+               ) );
+
+               $new_failures      = [];
+               $current_failures  = self::get_failures( $post_id );
+               $previous_failures = [];
+
+               if ( ! empty( $previous_results ) )  {
+                       $previous_failures = self::get_failures( $previous_results[0]->ID );
+               }
+
+               // Find new failures that didn't exist in the previous run.
+
+               foreach( $current_failures as $test_suite => $test_cases ) {
+                       foreach( $test_cases as $test_case ) {
+                               if (
+                                 ! isset( $previous_failures[ $test_suite] ) ||
+                                 ! in_array( $test_case, $previous_failures[ $test_suite ] )
+                               ) {
+                                       $new_failures[] = "$test_suite::$test_case";
+                               }
+                       }
+               }
+
+               return $new_failures;
+       }
+
+       private static function get_failures( $post_id ) {
+               $results = get_post_meta( $post_id, 'results', true );
+               if ( empty( $results['failures'] ) && empty( $results['errors'] ) ) {
+                       return [];
+               }
+
+               $failures = [];
+
+               foreach ( $results['testsuites'] as $suite_name => $testsuite ) {
+                       $failures[ $suite_name ] = array_keys( $testsuite['testcases'] );
+               }
+
+               return $failures;
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Maybe send an email notification if 'wpdevbot' has reported
</span><span class="cx" style="display: block; padding: 0 10px">         * a success and others have reported failures.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -204,21 +360,35 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( $wpdevbot_result->ID === $result->ID ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                continue;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         // If the test result is failed and we haven't yet sent an
</span><span class="cx" style="display: block; padding: 0 10px">                        // email notification, then let the reporter know.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( self::is_failed_result( $result )
-                               && ! get_post_meta( $result->ID, 'ptr_reported_failure', true ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if (
+                         self::is_failed_result( $result )     &&
+                         ! get_post_meta( $result->ID, 'ptr_reported_failure', true )
+                       ) {
+                               $new_failures = self::get_new_failures( $result->ID );
+
+                               if ( empty( $new_failures ) ) {
+                                       continue;
+                               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $user = get_user_by( 'id', $result->post_author );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( $user ) {
-                                       $subject = '[Host Test Results] Test failure for ' . $result->post_name;
-                                       $body    = 'Hi there,' . PHP_EOL . PHP_EOL
-                                               . "We've detected a WordPress PHPUnit test failure on your hosting environment. Please review when you have a moment: "
-                                               . get_permalink( $result->ID ) . PHP_EOL . PHP_EOL
-                                               . 'Thanks,' . PHP_EOL . PHP_EOL
-                                               . 'WordPress.org Hosting Community';
-                                       wp_mail( $user->user_email, $subject, $body );
-                                       update_post_meta( $result->ID, 'ptr_reported_failure', true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( ! $user ) {
+                                       continue;
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $subject = '[Host Test Results] Test failure for ' . $result->post_name;
+                               $body    = 'Hi there,' . PHP_EOL . PHP_EOL
+                                       . "We've detected a new WordPress PHPUnit test failure on your hosting environment. Please review when you have a moment: "
+                                       . get_permalink( $result->ID ) . PHP_EOL . PHP_EOL
+                                       . 'New failures:' . PHP_EOL . PHP_EOL
+                                       . implode( PHP_EOL, $new_failures ) . PHP_EOL . PHP_EOL
+                                       . 'Thanks,' . PHP_EOL . PHP_EOL
+                                       . 'WordPress.org Hosting Community';
+
+                               wp_mail( $user->user_email, $subject, $body );
+                               update_post_meta( $result->ID, 'ptr_reported_failure', true );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -227,7 +397,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Whether or not a given result is a failed result.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param WP_Post $post Result post object.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param \WP_Post $post Result post object.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @return boolean
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private static function is_failed_result( $post ) {
</span></span></pre>
</div>
</div>

</body>
</html>