Aude has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/343532 )
Change subject: Avoid database access in ItemHandlerTest data provider
......................................................................
Avoid database access in ItemHandlerTest data provider
ItemContent constructor access the database when a redirect title
is passed. (to check if the redirect has same content model
and the title doesn't already have content model set on the object)
We can work around this by setting the content model on the
title object.
It would be nicer if we could altogether avoid database access
in the constructor (maybe by removing the check and checking
elsewhere when creating redirects?) but not sure and don't want
to do that in this patch.
Change-Id: I16c3252892595ef79a9f865c850e02066093d053
---
M repo/tests/phpunit/includes/Content/ItemHandlerTest.php
1 file changed, 16 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/32/343532/1
diff --git a/repo/tests/phpunit/includes/Content/ItemHandlerTest.php
b/repo/tests/phpunit/includes/Content/ItemHandlerTest.php
index 87249b7..06833bb 100644
--- a/repo/tests/phpunit/includes/Content/ItemHandlerTest.php
+++ b/repo/tests/phpunit/includes/Content/ItemHandlerTest.php
@@ -90,6 +90,22 @@
}
/**
+ * @param ItemId $id
+ * @param ItemId $targetId
+ *
+ * @return ItemContent
+ */
+ protected function newRedirectItemContent( ItemId $id, ItemId $targetId
) {
+ $redirect = new EntityRedirect( $id, $targetId );
+
+ $handler = $this->getHandler();
+ $title = $handler->getTitleForId( $redirect->getTargetId() );
+ $title->setContentModel( $handler->getModelID() );
+
+ return ItemContent::newFromRedirect( $redirect, $title );
+ }
+
+ /**
* @param EntityDocument|null $entity
*
* @return EntityContent
--
To view, visit https://gerrit.wikimedia.org/r/343532
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I16c3252892595ef79a9f865c850e02066093d053
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits