Merge "Fix multiple PHP class declarations in one file in tests"

This commit is contained in:
jenkins-bot 2018-01-23 01:26:20 +00:00 committed by Gerrit Code Review
commit f2f39e0e99
6 changed files with 31 additions and 30 deletions

View file

@ -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" />

View file

@ -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",

View file

@ -65,13 +65,3 @@ class EchoAbstractMapperTest extends MediaWikiTestCase {
}
}
/**
* Create a stub class for testing the abstract class
*/
class EchoAbstractMapperStub extends EchoAbstractMapper {
public function testMethod() {
}
}

View file

@ -0,0 +1,11 @@
<?php
/**
* Create a stub class for testing the abstract class
*/
class EchoAbstractMapperStub extends EchoAbstractMapper {
public function testMethod() {
}
}

View 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';
}
}

View file

@ -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';
}
}