mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-18 02:40:50 +00:00
c256faf968
This partly reverts commit c19c88567b
.
Bug: T192167
Depends-On: Ia12658554c94497a204b7f65f1a6f7b1fa0310ac
Change-Id: I4ef736d87d05f74920ce88f57b0ad824986adb26
23 lines
691 B
PHP
23 lines
691 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\MockObject\Invocation;
|
|
use PHPUnit\Framework\MockObject\Invocation\StaticInvocation;
|
|
use PHPUnit\Framework\MockObject\Stub\Stub;
|
|
|
|
class EchoExecuteFirstArgumentStub implements Stub {
|
|
public function invoke( Invocation $invocation ) {
|
|
if ( !$invocation instanceof StaticInvocation ) {
|
|
throw new PHPUnit\Framework\Exception( 'wrong invocation type' );
|
|
}
|
|
if ( !$invocation->arguments ) {
|
|
throw new PHPUnit\Framework\Exception( 'Method call must have an argument' );
|
|
}
|
|
|
|
return call_user_func( reset( $invocation->arguments ) );
|
|
}
|
|
|
|
public function toString() : string {
|
|
return 'return result of call_user_func on first invocation argument';
|
|
}
|
|
}
|