mediawiki-extensions-Echo/tests/phpunit/mapper/EchoExecuteFirstArgumentStub.php
Phantom42 ac6622711b Fix multiple PHP class declarations in one file in tests
All files containing more than one PHP class were split into
multiple files.

extension.json was updated to match new class locations.

phpcs `OneObjectStructurePerFile.MultipleFound` rule was
re-enabled.

Bug: T177809
Change-Id: I6fc2ec9cc35e6bac5a7c44d94b0f1b1b40e6dba5
2018-01-22 16:27:07 +02:00

19 lines
618 B
PHP

<?php
class EchoExecuteFirstArgumentStub implements PHPUnit_Framework_MockObject_Stub {
public function invoke( PHPUnit_Framework_MockObject_Invocation $invocation ) {
if ( !$invocation instanceof PHPUnit_Framework_MockObject_Invocation_Static ) {
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';
}
}