jenkins-bot has submitted this change and it was merged. Change subject: Don't set page_image property when there is no 'best' image ......................................................................
Don't set page_image property when there is no 'best' image Bug: T116889 Change-Id: Ica9d011dcc46c65c554eb12ba293df18e01f3dde --- M repo/includes/ParserOutput/PageImagesDataUpdate.php M repo/tests/phpunit/includes/ParserOutput/PageImagesDataUpdateTest.php 2 files changed, 13 insertions(+), 5 deletions(-) Approvals: Daniel Kinzler: Looks good to me, approved jenkins-bot: Verified diff --git a/repo/includes/ParserOutput/PageImagesDataUpdate.php b/repo/includes/ParserOutput/PageImagesDataUpdate.php index 8302c1b..14782cd 100644 --- a/repo/includes/ParserOutput/PageImagesDataUpdate.php +++ b/repo/includes/ParserOutput/PageImagesDataUpdate.php @@ -177,8 +177,10 @@ * @param ParserOutput $parserOutput */ public function updateParserOutput( ParserOutput $parserOutput ) { - // This property name is the only "soft dependency" on the PageImages extension. - $parserOutput->setProperty( 'page_image', $this->bestFileName ); + if ( $this->bestFileName !== null ) { + // This property name is the only "soft dependency" on the PageImages extension. + $parserOutput->setProperty( 'page_image', $this->bestFileName ); + } } } diff --git a/repo/tests/phpunit/includes/ParserOutput/PageImagesDataUpdateTest.php b/repo/tests/phpunit/includes/ParserOutput/PageImagesDataUpdateTest.php index 2289778..8d4f030 100644 --- a/repo/tests/phpunit/includes/ParserOutput/PageImagesDataUpdateTest.php +++ b/repo/tests/phpunit/includes/ParserOutput/PageImagesDataUpdateTest.php @@ -81,9 +81,15 @@ $parserOutput = $this->getMockBuilder( 'ParserOutput' ) ->disableOriginalConstructor() ->getMock(); - $parserOutput->expects( $this->once() ) - ->method( 'setProperty' ) - ->with( 'page_image', $expected ); + + if ( $expected !== null ) { + $parserOutput->expects( $this->once() ) + ->method( 'setProperty' ) + ->with( 'page_image', $expected ); + } else { + $parserOutput->expects( $this->never() ) + ->method( 'setProperty' ); + } $instance = $this->newInstance( $propertyIds ); -- To view, visit https://gerrit.wikimedia.org/r/249355 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ica9d011dcc46c65c554eb12ba293df18e01f3dde Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude <aude.w...@gmail.com> Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de> Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits