Thiemo Mättig (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/389958 )
Change subject: Update HistoryEntityAction constructor calls still providing a
Page
......................................................................
Update HistoryEntityAction constructor calls still providing a Page
This is a direct follow up for what was forgotten in Icf6055f.
Change-Id: Ia401c27318eee8adcf938884f5ec038d96f5fc86
---
M repo/includes/Actions/HistoryEntityAction.php
M repo/includes/Content/ItemHandler.php
M repo/includes/Content/PropertyHandler.php
M repo/tests/phpunit/includes/Actions/HistoryEntityActionTest.php
4 files changed, 19 insertions(+), 28 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/58/389958/1
diff --git a/repo/includes/Actions/HistoryEntityAction.php
b/repo/includes/Actions/HistoryEntityAction.php
index 770582f..ebf012f 100644
--- a/repo/includes/Actions/HistoryEntityAction.php
+++ b/repo/includes/Actions/HistoryEntityAction.php
@@ -28,18 +28,18 @@
private $labelLookup;
/**
- * @param Article $page
+ * @param Article $article
* @param IContextSource|null $context
* @param EntityIdLookup $entityIdLookup
* @param LabelDescriptionLookup $labelLookup
*/
public function __construct(
- Article $page,
+ Article $article,
IContextSource $context = null,
EntityIdLookup $entityIdLookup,
LabelDescriptionLookup $labelLookup
) {
- parent::__construct( $page, $context );
+ parent::__construct( $article, $context );
$this->entityIdLookup = $entityIdLookup;
$this->labelLookup = $labelLookup;
diff --git a/repo/includes/Content/ItemHandler.php
b/repo/includes/Content/ItemHandler.php
index 7642472..82a0301 100644
--- a/repo/includes/Content/ItemHandler.php
+++ b/repo/includes/Content/ItemHandler.php
@@ -2,9 +2,9 @@
namespace Wikibase\Repo\Content;
+use Article;
use DataUpdate;
use IContextSource;
-use Page;
use Title;
use Wikibase\Content\EntityHolder;
use Wikibase\DataModel\Entity\EntityDocument;
@@ -109,9 +109,9 @@
*/
public function getActionOverrides() {
return [
- 'history' => function( Page $page, IContextSource
$context = null ) {
+ 'history' => function( Article $article, IContextSource
$context = null ) {
return new HistoryEntityAction(
- $page,
+ $article,
$context,
$this->entityIdLookup,
$this->labelLookupFactory->newLabelDescriptionLookup( $context->getLanguage() )
diff --git a/repo/includes/Content/PropertyHandler.php
b/repo/includes/Content/PropertyHandler.php
index cbd1c31..718c060 100644
--- a/repo/includes/Content/PropertyHandler.php
+++ b/repo/includes/Content/PropertyHandler.php
@@ -2,9 +2,9 @@
namespace Wikibase\Repo\Content;
+use Article;
use DataUpdate;
use IContextSource;
-use Page;
use Title;
use Wikibase\Content\EntityHolder;
use Wikibase\DataModel\Entity\EntityId;
@@ -104,9 +104,9 @@
*/
public function getActionOverrides() {
return [
- 'history' => function( Page $page, IContextSource
$context = null ) {
+ 'history' => function( Article $article, IContextSource
$context = null ) {
return new HistoryEntityAction(
- $page,
+ $article,
$context,
$this->entityIdLookup,
$this->labelLookupFactory->newLabelDescriptionLookup( $context->getLanguage() )
diff --git a/repo/tests/phpunit/includes/Actions/HistoryEntityActionTest.php
b/repo/tests/phpunit/includes/Actions/HistoryEntityActionTest.php
index 20b9f67..53b857d 100644
--- a/repo/tests/phpunit/includes/Actions/HistoryEntityActionTest.php
+++ b/repo/tests/phpunit/includes/Actions/HistoryEntityActionTest.php
@@ -32,17 +32,14 @@
class HistoryEntityActionTest extends PHPUnit_Framework_TestCase {
/**
- * @param string $title
- *
* @return Article
*/
- private function getPage( $title ) {
+ private function getArticle() {
$page = $this->getMockBuilder( Article::class )
->disableOriginalConstructor()
->getMock();
- $page->expects( $this->any() )
- ->method( 'getTitle' )
- ->will( $this->returnValue( Title::newFromText( $title
) ) );
+ $page->method( 'getTitle' )
+ ->will( $this->returnValue( Title::newFromText( 'Page
title' ) ) );
$page->expects( $this->never() )
->method( 'getPage' )
// Deserializing the full entity may fail, see
https://gerrit.wikimedia.org/r/262881
@@ -69,27 +66,22 @@
*/
private function getContext( PHPUnit_Framework_MockObject_MockObject
$output ) {
$context = $this->getMock( IContextSource::class );
- $context->expects( $this->any() )
- ->method( 'getConfig' )
+ $context->method( 'getConfig' )
->will( $this->returnValue( new HashConfig( [
'UseFileCache' => false,
'UseMediaWikiUIEverywhere' => false,
'Localtimezone' => 'UTC',
] ) ) );
- $context->expects( $this->any() )
- ->method( 'getRequest' )
+ $context->method( 'getRequest' )
->will( $this->returnValue( new WebRequest() ) );
- $context->expects( $this->any() )
- ->method( 'getUser' )
+ $context->method( 'getUser' )
->will( $this->returnValue( new User() ) );
- $context->expects( $this->any() )
- ->method( 'msg' )
+ $context->method( 'msg' )
->will( $this->returnCallback( function() {
return call_user_func_array( 'wfMessage',
func_get_args() )->inLanguage( 'qqx' );
} ) );
- $context->expects( $this->any() )
- ->method( 'getOutput' )
+ $context->method( 'getOutput' )
->will( $this->returnValue( $output ) );
$output->expects( $this->once() )
@@ -129,8 +121,7 @@
->will( $this->returnValue( $entityId ) );
$labelLookup = $this->getMock( LabelDescriptionLookup::class );
- $labelLookup->expects( $this->any() )
- ->method( 'getLabel' )
+ $labelLookup->method( 'getLabel' )
->will( $this->returnValue( $label ) );
$output = $this->getOutput();
@@ -139,7 +130,7 @@
->with( $expected );
$action = new HistoryEntityAction(
- $this->getPage( 'Page title' ),
+ $this->getArticle(),
$this->getContext( $output ),
$entityIdLookup,
$labelLookup
--
To view, visit https://gerrit.wikimedia.org/r/389958
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia401c27318eee8adcf938884f5ec038d96f5fc86
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits