- Timestamp:
- 07/08/2019 12:55:20 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/phpunit7/speed-trap-listener.php
r45588 r45607 23 23 * @var int 24 24 */ 25 protected $slow Threshold;25 protected $slow_threshold; 26 26 27 27 /** … … 30 30 * @var int 31 31 */ 32 protected $report Length;32 protected $report_length; 33 33 34 34 /** … … 167 167 * 168 168 * @param int $time Test execution time in milliseconds 169 * @param int $slow Threshold Test execution time at which a test should be considered slow (milliseconds)169 * @param int $slow_threshold Test execution time at which a test should be considered slow (milliseconds) 170 170 * @return bool 171 171 */ 172 protected function isSlow( $time, $slow Threshold ) {173 return $time >= $slow Threshold;172 protected function isSlow( $time, $slow_threshold ) { 173 return $time >= $slow_threshold; 174 174 } 175 175 … … 221 221 */ 222 222 protected function getReportLength() { 223 return min( count( $this->slow ), $this->report Length );223 return min( count( $this->slow ), $this->report_length ); 224 224 } 225 225 … … 245 245 */ 246 246 protected function renderHeader() { 247 echo sprintf( "\n\nYou should really fix these slow tests (>%sms)...\n", $this->slow Threshold );247 echo sprintf( "\n\nYou should really fix these slow tests (>%sms)...\n", $this->slow_threshold ); 248 248 } 249 249 … … 252 252 */ 253 253 protected function renderBody() { 254 $slow Tests = $this->slow;255 256 $length = $this->getReportLength( $slow Tests );254 $slow_tests = $this->slow; 255 256 $length = $this->getReportLength( $slow_tests ); 257 257 for ( $i = 1; $i <= $length; ++$i ) { 258 $label = key( $slow Tests );259 $time = array_shift( $slow Tests );258 $label = key( $slow_tests ); 259 $time = array_shift( $slow_tests ); 260 260 261 261 echo sprintf( " %s. %sms to run %s\n", $i, $time, $label ); … … 269 269 $hidden = $this->getHiddenCount( $this->slow ); 270 270 if ( $hidden ) { 271 echo sprintf( '...and there %s %s more above your threshold hidden from view', $hidden == 1? 'is' : 'are', $hidden );271 echo sprintf( '...and there %s %s more above your threshold hidden from view', 1 === $hidden ? 'is' : 'are', $hidden ); 272 272 } 273 273 } … … 279 279 */ 280 280 protected function loadOptions( array $options ) { 281 $this->slow Threshold = isset( $options['slowThreshold'] ) ? $options['slowThreshold'] : 500;282 $this->report Length = isset( $options['reportLength'] ) ? $options['reportLength'] : 10;281 $this->slow_threshold = isset( $options['slowThreshold'] ) ? $options['slowThreshold'] : 500; 282 $this->report_length = isset( $options['reportLength'] ) ? $options['reportLength'] : 10; 283 283 } 284 284 … … 303 303 $ann = $test->getAnnotations(); 304 304 305 return isset( $ann['method']['slowThreshold'][0] ) ? $ann['method']['slowThreshold'][0] : $this->slow Threshold;305 return isset( $ann['method']['slowThreshold'][0] ) ? $ann['method']['slowThreshold'][0] : $this->slow_threshold; 306 306 } 307 307 }
Note: See TracChangeset
for help on using the changeset viewer.