jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/387302 )
Change subject: Use mock titles instead of bogus page IDs in tests.
......................................................................
Use mock titles instead of bogus page IDs in tests.
With MCR, Revision objects can no longer be constructed with a bad
page ID, unless a Title object is provided.
Change-Id: I3e069144c1958457e6fa9e44cbda8a6236b34993
---
M repo/tests/phpunit/includes/Content/EntityHandlerTest.php
M repo/tests/phpunit/includes/Notifications/ChangeNotifierTest.php
2 files changed, 28 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Thiemo Mättig (WMDE): Looks good to me, approved
diff --git a/repo/tests/phpunit/includes/Content/EntityHandlerTest.php
b/repo/tests/phpunit/includes/Content/EntityHandlerTest.php
index 024c989..0d2c12e 100644
--- a/repo/tests/phpunit/includes/Content/EntityHandlerTest.php
+++ b/repo/tests/phpunit/includes/Content/EntityHandlerTest.php
@@ -230,9 +230,22 @@
}
protected function fakeRevision( EntityContent $content, $id = 0 ) {
+ $title = $this->getMockBuilder( Title::class )
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $title->method( 'exists' )
+ ->will( $this->returnValue( true ) );
+
+ $title->method( 'getArticleId' )
+ ->will( $this->returnValue( $id ) );
+
+ $title->method( 'getLatestRevId' )
+ ->will( $this->returnValue( $id ) );
+
$revision = new Revision( [
'id' => $id,
- 'page' => $id,
+ 'title' => $title,
'content' => $content,
] );
diff --git a/repo/tests/phpunit/includes/Notifications/ChangeNotifierTest.php
b/repo/tests/phpunit/includes/Notifications/ChangeNotifierTest.php
index 81d98db..e6315f5 100644
--- a/repo/tests/phpunit/includes/Notifications/ChangeNotifierTest.php
+++ b/repo/tests/phpunit/includes/Notifications/ChangeNotifierTest.php
@@ -75,9 +75,22 @@
* @return Revision
*/
private function makeRevision( Content $content, User $user,
$revisionId, $timestamp, $parent_id = 0 ) {
+ $title = $this->getMockBuilder( Title::class )
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $title->method( 'exists' )
+ ->will( $this->returnValue( true ) );
+
+ $title->method( 'getArticleId' )
+ ->will( $this->returnValue( 7 ) );
+
+ $title->method( 'getLatestRevId' )
+ ->will( $this->returnValue( $revisionId ) );
+
return new Revision( [
'id' => $revisionId,
- 'page' => 7,
+ 'title' => $title,
'content' => $content,
'user' => $user->getId(),
'user_text' => $user->getName(),
--
To view, visit https://gerrit.wikimedia.org/r/387302
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3e069144c1958457e6fa9e44cbda8a6236b34993
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits