| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\Notifications\Test\Integration\Mapper; |
| 4 | |
| 5 | use PHPUnit\Framework\MockObject\Invocation; |
| 6 | use PHPUnit\Framework\MockObject\Invocation\StaticInvocation; |
| 7 | use PHPUnit\Framework\MockObject\Stub\Stub; |
| 8 | |
| 9 | class EchoExecuteFirstArgumentStub implements Stub { |
| 10 | public function invoke( Invocation $invocation ) { |
| 11 | if ( !$invocation instanceof StaticInvocation ) { |
| 12 | throw new \PHPUnit\Framework\Exception( 'wrong invocation type' ); |
| 13 | } |
| 14 | if ( !$invocation->arguments ) { |
| 15 | throw new \PHPUnit\Framework\Exception( 'Method call must have an argument' ); |
| 16 | } |
| 17 | |
| 18 | return call_user_func( reset( $invocation->arguments ) ); |
| 19 | } |
| 20 | |
| 21 | public function toString(): string { |
| 22 | return 'return result of call_user_func on first invocation argument'; |
| 23 | } |
| 24 | } |