jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/405718 )
Change subject: Fix multiple PHP class declarations in one file in tests
......................................................................
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
---
M .phpcs.xml
M extension.json
M tests/phpunit/mapper/AbstractMapperTest.php
A tests/phpunit/mapper/EchoAbstractMapperStub.php
A tests/phpunit/mapper/EchoExecuteFirstArgumentStub.php
M tests/phpunit/mapper/NotificationMapperTest.php
6 files changed, 31 insertions(+), 30 deletions(-)
Approvals:
Reedy: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.phpcs.xml b/.phpcs.xml
index 0df77d8..b7fd44c 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -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" />
diff --git a/extension.json b/extension.json
index 088b764..76c3493 100644
--- a/extension.json
+++ b/extension.json
@@ -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",
diff --git a/tests/phpunit/mapper/AbstractMapperTest.php
b/tests/phpunit/mapper/AbstractMapperTest.php
index 5c3a582..1d97789 100644
--- a/tests/phpunit/mapper/AbstractMapperTest.php
+++ b/tests/phpunit/mapper/AbstractMapperTest.php
@@ -65,13 +65,3 @@
}
}
-
-/**
- * Create a stub class for testing the abstract class
- */
-class EchoAbstractMapperStub extends EchoAbstractMapper {
-
- public function testMethod() {
- }
-
-}
diff --git a/tests/phpunit/mapper/EchoAbstractMapperStub.php
b/tests/phpunit/mapper/EchoAbstractMapperStub.php
new file mode 100644
index 0000000..359e97f
--- /dev/null
+++ b/tests/phpunit/mapper/EchoAbstractMapperStub.php
@@ -0,0 +1,11 @@
+<?php
+
+/**
+ * Create a stub class for testing the abstract class
+ */
+class EchoAbstractMapperStub extends EchoAbstractMapper {
+
+ public function testMethod() {
+ }
+
+}
diff --git a/tests/phpunit/mapper/EchoExecuteFirstArgumentStub.php
b/tests/phpunit/mapper/EchoExecuteFirstArgumentStub.php
new file mode 100644
index 0000000..1e2889e
--- /dev/null
+++ b/tests/phpunit/mapper/EchoExecuteFirstArgumentStub.php
@@ -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';
+ }
+}
diff --git a/tests/phpunit/mapper/NotificationMapperTest.php
b/tests/phpunit/mapper/NotificationMapperTest.php
index 024d817..68cca03 100644
--- a/tests/phpunit/mapper/NotificationMapperTest.php
+++ b/tests/phpunit/mapper/NotificationMapperTest.php
@@ -250,20 +250,3 @@
}
}
-
-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';
- }
-}
--
To view, visit https://gerrit.wikimedia.org/r/405718
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6fc2ec9cc35e6bac5a7c44d94b0f1b1b40e6dba5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Phantom42 <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits