<!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>[51573] trunk: Build/Test Tools: Remove SpeedTrapListener.</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="https://core.trac.wordpress.org/changeset/51573">51573</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/51573","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-08-07 11:14:39 +0000 (Sat, 07 Aug 2021)</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'>Build/Test Tools: Remove SpeedTrapListener.

Now that the tests can run PHPUnit cross-version and Composer will be used to install the test suite in CI, we could switch out the local copies of the [https://github.com/johnkary/phpunit-speedtrap PHPUnit speedtrap] package in favor of using the Composer package, which would prevent us having to make the WP local copies of the class compatible with later PHPUnit versions.

The SpeedTrap test listener was introduced to identify slow tests and take action on these to make them faster.

In practice, however, no notable action was ever taken based on the output of the test listener in all the years it was in place.

With that in mind, it was decided to remove the SpeedTrap test listeners without replacement.

If - at a future date - contributors would want to take action to speed up slow tests anyway, they can:
* Either add the package to their local install and use the output they receive locally to identify slow tests.
* Or use the PHPUnit native `@small` annotations in combination with the PHPUnit `PHP_Invoker` package as described in the PHPUnit documentation to [https://phpunit.readthedocs.io/en/stable/risky-tests.html#test-execution-timeout run tests with time limits].

Follow-up to <a href="https://core.trac.wordpress.org/changeset/35214">[35214]</a>, <a href="https://core.trac.wordpress.org/changeset/35226">[35226]</a>, <a href="https://core.trac.wordpress.org/changeset/35767">[35767]</a>, <a href="https://core.trac.wordpress.org/changeset/44701">[44701]</a>, [51559-51572].

Props jrf.
See <a href="https://core.trac.wordpress.org/ticket/46149">#46149</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkphpcsxmldist">trunk/phpcs.xml.dist</a></li>
<li><a href="#trunkphpunitxmldist">trunk/phpunit.xml.dist</a></li>
<li><a href="#trunktestsphpunitmultisitexml">trunk/tests/phpunit/multisite.xml</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunktestsphpunitincludeslistenerloaderphp">trunk/tests/phpunit/includes/listener-loader.php</a></li>
<li><a href="#trunktestsphpunitincludesphpunit7speedtraplistenerphp">trunk/tests/phpunit/includes/phpunit7/speed-trap-listener.php</a></li>
<li><a href="#trunktestsphpunitincludesspeedtraplistenerphp">trunk/tests/phpunit/includes/speed-trap-listener.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkphpcsxmldist"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/phpcs.xml.dist</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/phpcs.xml.dist      2021-08-07 11:00:52 UTC (rev 51572)
+++ trunk/phpcs.xml.dist        2021-08-07 11:14:39 UTC (rev 51573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -135,7 +135,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        <exclude-pattern>/src/wp-includes/Text/*</exclude-pattern>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <exclude-pattern>/tests/phpunit/includes/phpunit7/MockObject/*</exclude-pattern>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <exclude-pattern>/tests/phpunit/includes/speed-trap-listener\.php</exclude-pattern>
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <!-- Test data and fixtures. -->
</span><span class="cx" style="display: block; padding: 0 10px">        <exclude-pattern>/tests/phpunit/build*</exclude-pattern>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -266,7 +265,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                <element value="WP_PHPUnit_Util_Getopt"/>
</span><span class="cx" style="display: block; padding: 0 10px">                                <element value="PHPUnit_Util_Test"/>
</span><span class="cx" style="display: block; padding: 0 10px">                                <element value="WPProfiler"/>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <element value="SpeedTrapListener"/>
</del><span class="cx" style="display: block; padding: 0 10px">                                 <element value="PHPUnit_Framework_Exception"/>
</span><span class="cx" style="display: block; padding: 0 10px">                                <element value="Polyfill_TestCase"/>
</span><span class="cx" style="display: block; padding: 0 10px">                        </property>
</span></span></pre></div>
<a id="trunkphpunitxmldist"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/phpunit.xml.dist</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/phpunit.xml.dist    2021-08-07 11:00:52 UTC (rev 51572)
+++ trunk/phpunit.xml.dist      2021-08-07 11:14:39 UTC (rev 51573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,17 +29,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        <php>
</span><span class="cx" style="display: block; padding: 0 10px">                <const name="WP_RUN_CORE_TESTS" value="1" />
</span><span class="cx" style="display: block; padding: 0 10px">        </php>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <listeners>
-               <listener class="SpeedTrapListener" file="tests/phpunit/includes/listener-loader.php">
-                       <arguments>
-                               <array>
-                                       <element key="slowThreshold">
-                                               <integer>150</integer>
-                                       </element>
-                               </array>
-                       </arguments>
-               </listener>
-       </listeners>
</del><span class="cx" style="display: block; padding: 0 10px">         <filter>
</span><span class="cx" style="display: block; padding: 0 10px">                <whitelist addUncoveredFilesFromWhitelist="true">
</span><span class="cx" style="display: block; padding: 0 10px">                        <directory suffix=".php">src</directory>
</span></span></pre></div>
<a id="trunktestsphpunitincludeslistenerloaderphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/includes/listener-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/listener-loader.php  2021-08-07 11:00:52 UTC (rev 51572)
+++ trunk/tests/phpunit/includes/listener-loader.php    2021-08-07 11:14:39 UTC (rev 51573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,7 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-if ( version_compare( tests_get_phpunit_version(), '7.0', '>=' ) ) {
-       require __DIR__ . '/phpunit7/speed-trap-listener.php';
-} else {
-       require __DIR__ . '/speed-trap-listener.php';
-}
</del></span></pre></div>
<a id="trunktestsphpunitincludesphpunit7speedtraplistenerphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/includes/phpunit7/speed-trap-listener.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/phpunit7/speed-trap-listener.php     2021-08-07 11:00:52 UTC (rev 51572)
+++ trunk/tests/phpunit/includes/phpunit7/speed-trap-listener.php       2021-08-07 11:14:39 UTC (rev 51573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,307 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * A PHPUnit TestListener that exposes your slowest running tests by outputting
- * results directly to the console.
- */
-class SpeedTrapListener implements PHPUnit_Framework_TestListener {
-
-       /**
-        * Internal tracking for test suites.
-        *
-        * Increments as more suites are run, then decremented as they finish. All
-        * suites have been run when returns to 0.
-        *
-        * @var integer
-        */
-       protected $suites = 0;
-
-       /**
-        * Time in milliseconds at which a test will be considered "slow" and be
-        * reported by this listener.
-        *
-        * @var int
-        */
-       protected $slow_threshold;
-
-       /**
-        * Number of tests to report on for slowness.
-        *
-        * @var int
-        */
-       protected $report_length;
-
-       /**
-        * Collection of slow tests.
-        *
-        * @var array
-        */
-       protected $slow = array();
-
-       /**
-        * Construct a new instance.
-        *
-        * @param array $options
-        */
-       public function __construct( array $options = array() ) {
-               $this->loadOptions( $options );
-       }
-
-       /**
-        * An error occurred.
-        *
-        * @param PHPUnit_Framework_Test $test
-        * @param Exception              $e
-        * @param float                  $time
-        */
-       public function addError( PHPUnit\Framework\Test $test, Throwable $t, float $time ): void {
-       }
-
-       /**
-        * A warning occurred.
-        *
-        * @param PHPUnit_Framework_Test    $test
-        * @param PHPUnit_Framework_Warning $e
-        * @param float                     $time
-        * @since Method available since Release 5.1.0
-        */
-       public function addWarning( PHPUnit\Framework\Test $test, PHPUnit\Framework\Warning $e, float $time ): void {
-       }
-
-       /**
-        * A failure occurred.
-        *
-        * @param PHPUnit_Framework_Test                 $test
-        * @param PHPUnit_Framework_AssertionFailedError $e
-        * @param float                                  $time
-        */
-       public function addFailure( PHPUnit\Framework\Test $test, PHPUnit\Framework\AssertionFailedError $e, float $time ): void {
-       }
-
-       /**
-        * Incomplete test.
-        *
-        * @param PHPUnit_Framework_Test $test
-        * @param Exception              $e
-        * @param float                  $time
-        */
-       public function addIncompleteTest( PHPUnit\Framework\Test $test, Throwable $t, float $time ): void {
-       }
-
-       /**
-        * Risky test.
-        *
-        * @param PHPUnit_Framework_Test $test
-        * @param Exception              $e
-        * @param float                  $time
-        * @since  Method available since Release 4.0.0
-        */
-       public function addRiskyTest( PHPUnit\Framework\Test $test, Throwable $t, float $time ): void {
-       }
-
-       /**
-        * Skipped test.
-        *
-        * @param PHPUnit_Framework_Test $test
-        * @param Exception              $e
-        * @param float                  $time
-        */
-       public function addSkippedTest( PHPUnit\Framework\Test $test, Throwable $t, float $time ): void {
-       }
-
-       /**
-        * A test started.
-        *
-        * @param PHPUnit_Framework_Test $test
-        */
-       public function startTest( PHPUnit\Framework\Test $test ): void {
-       }
-
-       /**
-        * A test ended.
-        *
-        * @param PHPUnit_Framework_Test $test
-        * @param float                  $time
-        */
-       public function endTest( PHPUnit\Framework\Test $test, float $time ): void {
-               if ( ! $test instanceof PHPUnit_Framework_TestCase ) {
-                       return;
-               }
-
-               $time      = $this->toMilliseconds( $time );
-               $threshold = $this->getSlowThreshold( $test );
-
-               if ( $this->isSlow( $time, $threshold ) ) {
-                       $this->addSlowTest( $test, $time );
-               }
-       }
-
-       /**
-        * A test suite started.
-        *
-        * @param PHPUnit_Framework_TestSuite $suite
-        */
-       public function startTestSuite( PHPUnit\Framework\TestSuite $suite ): void {
-               $this->suites++;
-       }
-
-       /**
-        * A test suite ended.
-        *
-        * @param PHPUnit_Framework_TestSuite $suite
-        */
-       public function endTestSuite( PHPUnit\Framework\TestSuite $suite ): void {
-               $this->suites--;
-
-               if ( 0 === $this->suites && $this->hasSlowTests() ) {
-                       arsort( $this->slow ); // Sort longest running tests to the top.
-
-                       $this->renderHeader();
-                       $this->renderBody();
-                       $this->renderFooter();
-               }
-       }
-
-       /**
-        * Whether the given test execution time is considered slow.
-        *
-        * @param int $time           Test execution time in milliseconds
-        * @param int $slow_threshold Test execution time at which a test should be considered slow (milliseconds)
-        * @return bool
-        */
-       protected function isSlow( $time, $slow_threshold ) {
-               return $time >= $slow_threshold;
-       }
-
-       /**
-        * Stores a test as slow.
-        *
-        * @param PHPUnit_Framework_TestCase $test
-        * @param int                        $time Test execution time in milliseconds
-        */
-       protected function addSlowTest( PHPUnit_Framework_TestCase $test, $time ) {
-               $label = $this->makeLabel( $test );
-
-               $this->slow[ $label ] = $time;
-       }
-
-       /**
-        * Whether at least one test has been considered slow.
-        *
-        * @return bool
-        */
-       protected function hasSlowTests() {
-               return ! empty( $this->slow );
-       }
-
-       /**
-        * Convert PHPUnit's reported test time (microseconds) to milliseconds.
-        *
-        * @param float $time
-        * @return int
-        */
-       protected function toMilliseconds( $time ) {
-               return (int) round( $time * 1000 );
-       }
-
-       /**
-        * Label for describing a test.
-        *
-        * @param PHPUnit_Framework_TestCase $test
-        * @return string
-        */
-       protected function makeLabel( PHPUnit_Framework_TestCase $test ) {
-               return sprintf( '%s:%s', get_class( $test ), $test->getName() );
-       }
-
-       /**
-        * Calculate number of slow tests to report about.
-        *
-        * @return int
-        */
-       protected function getReportLength() {
-               return min( count( $this->slow ), $this->report_length );
-       }
-
-       /**
-        * Find how many slow tests occurred that won't be shown due to list length.
-        *
-        * @return int Number of hidden slow tests
-        */
-       protected function getHiddenCount() {
-               $total   = count( $this->slow );
-               $showing = $this->getReportLength( $this->slow );
-
-               $hidden = 0;
-               if ( $total > $showing ) {
-                       $hidden = $total - $showing;
-               }
-
-               return $hidden;
-       }
-
-       /**
-        * Renders slow test report header.
-        */
-       protected function renderHeader() {
-               echo sprintf( "\n\nYou should really fix these slow tests (>%sms)...\n", $this->slow_threshold );
-       }
-
-       /**
-        * Renders slow test report body.
-        */
-       protected function renderBody() {
-               $slow_tests = $this->slow;
-
-               $length = $this->getReportLength( $slow_tests );
-               for ( $i = 1; $i <= $length; ++$i ) {
-                       $label = key( $slow_tests );
-                       $time  = array_shift( $slow_tests );
-
-                       echo sprintf( " %s. %sms to run %s\n", $i, $time, $label );
-               }
-       }
-
-       /**
-        * Renders slow test report footer.
-        */
-       protected function renderFooter() {
-               $hidden = $this->getHiddenCount( $this->slow );
-               if ( $hidden ) {
-                       echo sprintf( '...and there %s %s more above your threshold hidden from view', 1 === $hidden ? 'is' : 'are', $hidden );
-               }
-       }
-
-       /**
-        * Populate options into class internals.
-        *
-        * @param array $options
-        */
-       protected function loadOptions( array $options ) {
-               $this->slow_threshold = isset( $options['slowThreshold'] ) ? $options['slowThreshold'] : 500;
-               $this->report_length  = isset( $options['reportLength'] ) ? $options['reportLength'] : 10;
-       }
-
-       /**
-        * Get slow test threshold for given test. A TestCase can override the
-        * suite-wide slow threshold by using the annotation @slowThreshold with
-        * the threshold value in milliseconds.
-        *
-        * The following test will only be considered slow when its execution time
-        * reaches 5000ms (5 seconds):
-        *
-        * <code>
-        *
-        * @slowThreshold 5000
-        * public function testLongRunningProcess() {}
-        * </code>
-        *
-        * @param PHPUnit_Framework_TestCase $test
-        * @return int
-        */
-       protected function getSlowThreshold( PHPUnit_Framework_TestCase $test ) {
-               $ann = $test->getAnnotations();
-
-               return isset( $ann['method']['slowThreshold'][0] ) ? $ann['method']['slowThreshold'][0] : $this->slow_threshold;
-       }
-}
</del></span></pre></div>
<a id="trunktestsphpunitincludesspeedtraplistenerphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/includes/speed-trap-listener.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/speed-trap-listener.php      2021-08-07 11:00:52 UTC (rev 51572)
+++ trunk/tests/phpunit/includes/speed-trap-listener.php        2021-08-07 11:14:39 UTC (rev 51573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,307 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * A PHPUnit TestListener that exposes your slowest running tests by outputting
- * results directly to the console.
- */
-class SpeedTrapListener implements PHPUnit_Framework_TestListener {
-
-       /**
-        * Internal tracking for test suites.
-        *
-        * Increments as more suites are run, then decremented as they finish. All
-        * suites have been run when returns to 0.
-        *
-        * @var integer
-        */
-       protected $suites = 0;
-
-       /**
-        * Time in milliseconds at which a test will be considered "slow" and be
-        * reported by this listener.
-        *
-        * @var int
-        */
-       protected $slow_threshold;
-
-       /**
-        * Number of tests to report on for slowness.
-        *
-        * @var int
-        */
-       protected $report_length;
-
-       /**
-        * Collection of slow tests.
-        *
-        * @var array
-        */
-       protected $slow = array();
-
-       /**
-        * Construct a new instance.
-        *
-        * @param array $options
-        */
-       public function __construct( array $options = array() ) {
-               $this->loadOptions( $options );
-       }
-
-       /**
-        * An error occurred.
-        *
-        * @param PHPUnit_Framework_Test $test
-        * @param Exception              $e
-        * @param float                  $time
-        */
-       public function addError( PHPUnit_Framework_Test $test, Exception $e, $time ) {
-       }
-
-       /**
-        * A warning occurred.
-        *
-        * @param PHPUnit_Framework_Test    $test
-        * @param PHPUnit_Framework_Warning $e
-        * @param float                     $time
-        * @since Method available since Release 5.1.0
-        */
-       public function addWarning( PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, $time ) {
-       }
-
-       /**
-        * A failure occurred.
-        *
-        * @param PHPUnit_Framework_Test                 $test
-        * @param PHPUnit_Framework_AssertionFailedError $e
-        * @param float                                  $time
-        */
-       public function addFailure( PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time ) {
-       }
-
-       /**
-        * Incomplete test.
-        *
-        * @param PHPUnit_Framework_Test $test
-        * @param Exception              $e
-        * @param float                  $time
-        */
-       public function addIncompleteTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
-       }
-
-       /**
-        * Risky test.
-        *
-        * @param PHPUnit_Framework_Test $test
-        * @param Exception              $e
-        * @param float                  $time
-        * @since  Method available since Release 4.0.0
-        */
-       public function addRiskyTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
-       }
-
-       /**
-        * Skipped test.
-        *
-        * @param PHPUnit_Framework_Test $test
-        * @param Exception              $e
-        * @param float                  $time
-        */
-       public function addSkippedTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
-       }
-
-       /**
-        * A test started.
-        *
-        * @param PHPUnit_Framework_Test $test
-        */
-       public function startTest( PHPUnit_Framework_Test $test ) {
-       }
-
-       /**
-        * A test ended.
-        *
-        * @param PHPUnit_Framework_Test $test
-        * @param float                  $time
-        */
-       public function endTest( PHPUnit_Framework_Test $test, $time ) {
-               if ( ! $test instanceof PHPUnit_Framework_TestCase ) {
-                       return;
-               }
-
-               $time      = $this->toMilliseconds( $time );
-               $threshold = $this->getSlowThreshold( $test );
-
-               if ( $this->isSlow( $time, $threshold ) ) {
-                       $this->addSlowTest( $test, $time );
-               }
-       }
-
-       /**
-        * A test suite started.
-        *
-        * @param PHPUnit_Framework_TestSuite $suite
-        */
-       public function startTestSuite( PHPUnit_Framework_TestSuite $suite ) {
-               $this->suites++;
-       }
-
-       /**
-        * A test suite ended.
-        *
-        * @param PHPUnit_Framework_TestSuite $suite
-        */
-       public function endTestSuite( PHPUnit_Framework_TestSuite $suite ) {
-               $this->suites--;
-
-               if ( 0 === $this->suites && $this->hasSlowTests() ) {
-                       arsort( $this->slow ); // Sort longest running tests to the top.
-
-                       $this->renderHeader();
-                       $this->renderBody();
-                       $this->renderFooter();
-               }
-       }
-
-       /**
-        * Whether the given test execution time is considered slow.
-        *
-        * @param int $time           Test execution time in milliseconds
-        * @param int $slow_threshold Test execution time at which a test should be considered slow (milliseconds)
-        * @return bool
-        */
-       protected function isSlow( $time, $slow_threshold ) {
-               return $time >= $slow_threshold;
-       }
-
-       /**
-        * Stores a test as slow.
-        *
-        * @param PHPUnit_Framework_TestCase $test
-        * @param int                        $time Test execution time in milliseconds
-        */
-       protected function addSlowTest( PHPUnit_Framework_TestCase $test, $time ) {
-               $label = $this->makeLabel( $test );
-
-               $this->slow[ $label ] = $time;
-       }
-
-       /**
-        * Whether at least one test has been considered slow.
-        *
-        * @return bool
-        */
-       protected function hasSlowTests() {
-               return ! empty( $this->slow );
-       }
-
-       /**
-        * Convert PHPUnit's reported test time (microseconds) to milliseconds.
-        *
-        * @param float $time
-        * @return int
-        */
-       protected function toMilliseconds( $time ) {
-               return (int) round( $time * 1000 );
-       }
-
-       /**
-        * Label for describing a test.
-        *
-        * @param PHPUnit_Framework_TestCase $test
-        * @return string
-        */
-       protected function makeLabel( PHPUnit_Framework_TestCase $test ) {
-               return sprintf( '%s:%s', get_class( $test ), $test->getName() );
-       }
-
-       /**
-        * Calculate number of slow tests to report about.
-        *
-        * @return int
-        */
-       protected function getReportLength() {
-               return min( count( $this->slow ), $this->report_length );
-       }
-
-       /**
-        * Find how many slow tests occurred that won't be shown due to list length.
-        *
-        * @return int Number of hidden slow tests
-        */
-       protected function getHiddenCount() {
-               $total   = count( $this->slow );
-               $showing = $this->getReportLength( $this->slow );
-
-               $hidden = 0;
-               if ( $total > $showing ) {
-                       $hidden = $total - $showing;
-               }
-
-               return $hidden;
-       }
-
-       /**
-        * Renders slow test report header.
-        */
-       protected function renderHeader() {
-               echo sprintf( "\n\nYou should really fix these slow tests (>%sms)...\n", $this->slow_threshold );
-       }
-
-       /**
-        * Renders slow test report body.
-        */
-       protected function renderBody() {
-               $slow_tests = $this->slow;
-
-               $length = $this->getReportLength( $slow_tests );
-               for ( $i = 1; $i <= $length; ++$i ) {
-                       $label = key( $slow_tests );
-                       $time  = array_shift( $slow_tests );
-
-                       echo sprintf( " %s. %sms to run %s\n", $i, $time, $label );
-               }
-       }
-
-       /**
-        * Renders slow test report footer.
-        */
-       protected function renderFooter() {
-               $hidden = $this->getHiddenCount( $this->slow );
-               if ( $hidden ) {
-                       echo sprintf( '...and there %s %s more above your threshold hidden from view', 1 === $hidden ? 'is' : 'are', $hidden );
-               }
-       }
-
-       /**
-        * Populate options into class internals.
-        *
-        * @param array $options
-        */
-       protected function loadOptions( array $options ) {
-               $this->slow_threshold = isset( $options['slowThreshold'] ) ? $options['slowThreshold'] : 500;
-               $this->report_length  = isset( $options['reportLength'] ) ? $options['reportLength'] : 10;
-       }
-
-       /**
-        * Get slow test threshold for given test. A TestCase can override the
-        * suite-wide slow threshold by using the annotation @slowThreshold with
-        * the threshold value in milliseconds.
-        *
-        * The following test will only be considered slow when its execution time
-        * reaches 5000ms (5 seconds):
-        *
-        * <code>
-        *
-        * @slowThreshold 5000
-        * public function testLongRunningProcess() {}
-        * </code>
-        *
-        * @param PHPUnit_Framework_TestCase $test
-        * @return int
-        */
-       protected function getSlowThreshold( PHPUnit_Framework_TestCase $test ) {
-               $ann = $test->getAnnotations();
-
-               return isset( $ann['method']['slowThreshold'][0] ) ? $ann['method']['slowThreshold'][0] : $this->slow_threshold;
-       }
-}
</del></span></pre></div>
<a id="trunktestsphpunitmultisitexml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/multisite.xml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/multisite.xml 2021-08-07 11:00:52 UTC (rev 51572)
+++ trunk/tests/phpunit/multisite.xml   2021-08-07 11:14:39 UTC (rev 51573)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,17 +28,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <group>oembed-headers</group>
</span><span class="cx" style="display: block; padding: 0 10px">                </exclude>
</span><span class="cx" style="display: block; padding: 0 10px">        </groups>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <listeners>
-               <listener class="SpeedTrapListener" file="tests/phpunit/includes/listener-loader.php">
-                       <arguments>
-                               <array>
-                                       <element key="slowThreshold">
-                                               <integer>150</integer>
-                                       </element>
-                               </array>
-                       </arguments>
-               </listener>
-       </listeners>
</del><span class="cx" style="display: block; padding: 0 10px">         <filter>
</span><span class="cx" style="display: block; padding: 0 10px">                <whitelist addUncoveredFilesFromWhitelist="true">
</span><span class="cx" style="display: block; padding: 0 10px">                        <directory suffix=".php">../../src</directory>
</span></span></pre>
</div>
</div>

</body>
</html>