Aleksey Bekh-Ivanov (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342900 )
Change subject: Remove laziness from getEntityInfoBuilderFactory()
......................................................................
Remove laziness from getEntityInfoBuilderFactory()
Laziness is not needed as soon as there is only one caller which already
stores recieved service
Change-Id: Icfc29fcebd1819bdb358cb465aef9c073d224ffd
---
M client/includes/DispatchingServiceFactory.php
M client/tests/phpunit/includes/DispatchingServiceFactoryTest.php
2 files changed, 8 insertions(+), 17 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/00/342900/1
diff --git a/client/includes/DispatchingServiceFactory.php
b/client/includes/DispatchingServiceFactory.php
index bc5993c..3360a4c 100644
--- a/client/includes/DispatchingServiceFactory.php
+++ b/client/includes/DispatchingServiceFactory.php
@@ -143,7 +143,9 @@
* @return EntityInfoBuilderFactory
*/
public function getEntityInfoBuilderFactory() {
- return $this->container->getService( 'EntityInfoBuilderFactory'
);
+ return new DispatchingEntityInfoBuilderFactory(
+ $this->getServiceMap( 'EntityInfoBuilderFactory' )
+ );
}
/**
@@ -201,12 +203,6 @@
*/
private function getWiring() {
return [
- 'EntityInfoBuilderFactory' => function () {
- return new DispatchingEntityInfoBuilderFactory(
- $this->getServiceMap(
'EntityInfoBuilderFactory' )
- );
- },
-
'EntityPrefetcher' => function () {
return new DispatchingEntityPrefetcher(
$this->getServiceMap(
'EntityPrefetcher' )
diff --git a/client/tests/phpunit/includes/DispatchingServiceFactoryTest.php
b/client/tests/phpunit/includes/DispatchingServiceFactoryTest.php
index a9c6321..2f753d4 100644
--- a/client/tests/phpunit/includes/DispatchingServiceFactoryTest.php
+++ b/client/tests/phpunit/includes/DispatchingServiceFactoryTest.php
@@ -53,19 +53,14 @@
);
}
- public function
testGetEntityInfoBuilderFactory_AlwaysReturnsTheSameService() {
+ public function testGetEntityPrefetcher_AlwaysReturnsTheSameService() {
$factory =
$this->createFactoryWithRepositoryContainerReturningDummyObjectFor(
- 'EntityInfoBuilderFactory',
- EntityInfoBuilderFactory::class
+ 'EntityPrefetcher',
+ EntityPrefetcher::class
);
- $this->assertInstanceOf(
- DispatchingEntityInfoBuilderFactory::class,
- $factory->getEntityInfoBuilderFactory()
- );
-
- $serviceOne = $factory->getEntityInfoBuilderFactory();
- $serviceTwo = $factory->getEntityInfoBuilderFactory();
+ $serviceOne = $factory->getEntityPrefetcher();
+ $serviceTwo = $factory->getEntityPrefetcher();
$this->assertSame( $serviceOne, $serviceTwo );
}
--
To view, visit https://gerrit.wikimedia.org/r/342900
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icfc29fcebd1819bdb358cb465aef9c073d224ffd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aleksey Bekh-Ivanov (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits