mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-25 03:09:37 +00:00
Merge "Fix multiple PHP class declarations in one file in tests"
This commit is contained in:
commit
f2f39e0e99
|
@ -3,7 +3,6 @@
|
|||
<file>.</file>
|
||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
||||
<exclude name="Generic.Files.LineLength.TooLong" />
|
||||
<exclude name="Generic.Files.OneObjectStructurePerFile.MultipleFound" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.ExtraParamComment" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamComment" />
|
||||
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
|
||||
|
|
|
@ -919,7 +919,7 @@
|
|||
"ContainmentSetTest": "tests/phpunit/ContainmentSetTest.php",
|
||||
"EchoAbstractEntity": "includes/model/AbstractEntity.php",
|
||||
"EchoAbstractMapper": "includes/mapper/AbstractMapper.php",
|
||||
"EchoAbstractMapperStub": "tests/phpunit/mapper/AbstractMapperTest.php",
|
||||
"EchoAbstractMapperStub": "tests/phpunit/mapper/EchoAbstractMapperStub.php",
|
||||
"EchoAbstractMapperTest": "tests/phpunit/mapper/AbstractMapperTest.php",
|
||||
"EchoArrayList": "includes/EchoArrayList.php",
|
||||
"EchoAttributeManager": "includes/AttributeManager.php",
|
||||
|
@ -948,7 +948,7 @@
|
|||
"EchoEventMapper": "includes/mapper/EventMapper.php",
|
||||
"EchoEventMapperTest": "tests/phpunit/mapper/EventMapperTest.php",
|
||||
"EchoEventPresentationModel": "includes/formatters/EventPresentationModel.php",
|
||||
"EchoExecuteFirstArgumentStub": "tests/phpunit/mapper/NotificationMapperTest.php",
|
||||
"EchoExecuteFirstArgumentStub": "tests/phpunit/mapper/EchoExecuteFirstArgumentStub.php",
|
||||
"EchoFilteredSequentialIterator": "includes/iterator/FilteredSequentialIterator.php",
|
||||
"EchoFlyoutFormatter": "includes/formatters/EchoFlyoutFormatter.php",
|
||||
"EchoForeignNotifications": "includes/ForeignNotifications.php",
|
||||
|
|
|
@ -65,13 +65,3 @@ class EchoAbstractMapperTest extends MediaWikiTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a stub class for testing the abstract class
|
||||
*/
|
||||
class EchoAbstractMapperStub extends EchoAbstractMapper {
|
||||
|
||||
public function testMethod() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
11
tests/phpunit/mapper/EchoAbstractMapperStub.php
Normal file
11
tests/phpunit/mapper/EchoAbstractMapperStub.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Create a stub class for testing the abstract class
|
||||
*/
|
||||
class EchoAbstractMapperStub extends EchoAbstractMapper {
|
||||
|
||||
public function testMethod() {
|
||||
}
|
||||
|
||||
}
|
18
tests/phpunit/mapper/EchoExecuteFirstArgumentStub.php
Normal file
18
tests/phpunit/mapper/EchoExecuteFirstArgumentStub.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?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';
|
||||
}
|
||||
}
|
|
@ -250,20 +250,3 @@ class EchoNotificationMapperTest extends MediaWikiTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
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';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue