Benchmark: Force string representation of arguments
Output becomes:
`MediaWiki\Extension\TrustedXFF\TrustedXFF::onIsTrustedProxy('107.167.115.215', false)`
Rather than:
`MediaWiki\Extension\TrustedXFF\TrustedXFF::onIsTrustedProxy('107.167.115.215', )`
Change-Id: Id0139283ab15f0060c61425d89f76fed309855e2
This commit is contained in:
parent
dfd3619c32
commit
0285cf5c8f
2 changed files with 19 additions and 11 deletions
|
|
@ -79,7 +79,15 @@ abstract class Benchmarker extends Maintenance {
|
|||
}
|
||||
$name = sprintf( "%s(%s)",
|
||||
$name,
|
||||
implode( ', ', $bench['args'] )
|
||||
implode(
|
||||
', ',
|
||||
array_map(
|
||||
static function ( $a ) {
|
||||
return var_export( $a, true );
|
||||
},
|
||||
$bench['args']
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class BenchmarkerTest extends \PHPUnit\Framework\TestCase {
|
|||
$count = 0;
|
||||
$bench->bench( [
|
||||
'test' => static function () use ( &$count ) {
|
||||
$count++;
|
||||
$count++;
|
||||
}
|
||||
] );
|
||||
|
||||
|
|
@ -41,10 +41,10 @@ class BenchmarkerTest extends \PHPUnit\Framework\TestCase {
|
|||
$bench->bench( [
|
||||
'test' => [
|
||||
'setup' => static function () use ( &$buffer ) {
|
||||
$buffer[] = 'setup';
|
||||
$buffer[] = 'setup';
|
||||
},
|
||||
'function' => static function () use ( &$buffer ) {
|
||||
$buffer[] = 'run';
|
||||
$buffer[] = 'run';
|
||||
}
|
||||
]
|
||||
] );
|
||||
|
|
@ -61,9 +61,9 @@ class BenchmarkerTest extends \PHPUnit\Framework\TestCase {
|
|||
|
||||
$bench->expects( $this->exactly( 2 ) )->method( 'hasOption' )
|
||||
->will( $this->returnValueMap( [
|
||||
[ 'verbose', true ],
|
||||
[ 'count', false ],
|
||||
] ) );
|
||||
[ 'verbose', true ],
|
||||
[ 'count', false ],
|
||||
] ) );
|
||||
|
||||
$bench->expects( $this->once() )->method( 'verboseRun' )
|
||||
->with( 0 )
|
||||
|
|
@ -104,7 +104,7 @@ class BenchmarkerTest extends \PHPUnit\Framework\TestCase {
|
|||
|
||||
$bench->expects( $this->once() )->method( 'addResult' )
|
||||
->with( $this->callback( static function ( $res ) {
|
||||
return $res['name'] === 'strtolower(A)';
|
||||
return $res['name'] === "strtolower('A')";
|
||||
} ) );
|
||||
|
||||
$bench->bench( [ [
|
||||
|
|
@ -125,9 +125,9 @@ class BenchmarkerTest extends \PHPUnit\Framework\TestCase {
|
|||
|
||||
$bench->expects( $this->exactly( 2 ) )->method( 'hasOption' )
|
||||
->will( $this->returnValueMap( [
|
||||
[ 'verbose', true ],
|
||||
[ 'count', false ],
|
||||
] ) );
|
||||
[ 'verbose', true ],
|
||||
[ 'count', false ],
|
||||
] ) );
|
||||
|
||||
$bench->expects( $this->once() )->method( 'output' )
|
||||
->with( $this->callback( static function ( $out ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue