mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-01 02:46:46 +00:00
7e9e549743
Bug: T192167 Change-Id: Id309ad5933371dd835ec431ded80f650e228099c
23 lines
677 B
PHP
23 lines
677 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\MockObject\Invocation;
|
|
use PHPUnit\Framework\MockObject\Invocation\StaticInvocation;
|
|
use PHPUnit\Framework\MockObject\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() {
|
|
return 'return result of call_user_func on first invocation argument';
|
|
}
|
|
}
|