jenkins-bot has submitted this change and it was merged.
Change subject: Use PHP 5.5's …::class feature instead of strings in lib
......................................................................
Use PHP 5.5's …::class feature instead of strings in lib
I577208e does the same in client, and I2c1a4d6 in view.
This is not a blind, fully automatic replacement. I reviewed every
replacement.
Change-Id: I9fd51401d4b48940eeeafc430addbe4091afb8bc
---
M lib/tests/phpunit/ChangeNotificationJobTest.php
M lib/tests/phpunit/DataValueFactoryTest.php
M lib/tests/phpunit/EntityTypesTest.php
M lib/tests/phpunit/Interactors/TermIndexSearchInteractorTest.php
M lib/tests/phpunit/Reporting/ReportingExceptionHandlerTest.php
M lib/tests/phpunit/changes/EntityChangeTest.php
M lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php
M lib/tests/phpunit/formatters/DispatchingValueFormatterTest.php
M lib/tests/phpunit/formatters/EntityIdHtmlLinkFormatterTest.php
M lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
M lib/tests/phpunit/formatters/EntityIdPlainLinkFormatterTest.php
M lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
M lib/tests/phpunit/formatters/ErrorHandlingSnakFormatterTest.php
M lib/tests/phpunit/formatters/EscapingSnakFormatterTest.php
M lib/tests/phpunit/formatters/FormatterLabelDescriptionLookupFactoryTest.php
M lib/tests/phpunit/formatters/HtmlExternalIdentifierFormatterTest.php
M lib/tests/phpunit/formatters/HtmlTimeFormatterTest.php
M lib/tests/phpunit/formatters/MessageSnakFormatterTest.php
M lib/tests/phpunit/formatters/MonolingualHtmlFormatterTest.php
M lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php
M lib/tests/phpunit/formatters/OutputFormatValueFormatterFactoryTest.php
M lib/tests/phpunit/formatters/PropertyValueSnakFormatterTest.php
M lib/tests/phpunit/formatters/QuantityDetailsFormatterTest.php
M lib/tests/phpunit/formatters/TimeDetailsFormatterTest.php
M lib/tests/phpunit/formatters/VocabularyUriFormatterTest.php
M lib/tests/phpunit/formatters/WikibaseSnakFormatterBuildersTest.php
M lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
M lib/tests/phpunit/formatters/WikitextExternalIdentifierFormatterTest.php
M lib/tests/phpunit/includes/modules/RepoAccessModuleTest.php
M lib/tests/phpunit/includes/modules/SitesModuleTest.php
M lib/tests/phpunit/includes/modules/SitesModuleWorkerTest.php
M lib/tests/phpunit/includes/serialization/CallbackFactoryTest.php
M lib/tests/phpunit/store/BufferingTermLookupTest.php
M lib/tests/phpunit/store/CachingSiteLinkLookupTest.php
M lib/tests/phpunit/store/FieldPropertyInfoProviderTest.php
M lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
M lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupTest.php
M lib/tests/phpunit/store/PrefetchingWikiPageEntityMetaDataAccessorTest.php
M lib/tests/phpunit/store/RevisionBasedEntityLookupTest.php
M lib/tests/phpunit/store/Sql/ChangeLookupTest.php
M lib/tests/phpunit/store/Sql/TermSqlIndexTest.php
41 files changed, 161 insertions(+), 97 deletions(-)
Approvals:
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/tests/phpunit/ChangeNotificationJobTest.php
b/lib/tests/phpunit/ChangeNotificationJobTest.php
index 9aa26b3..842ba02 100644
--- a/lib/tests/phpunit/ChangeNotificationJobTest.php
+++ b/lib/tests/phpunit/ChangeNotificationJobTest.php
@@ -2,6 +2,7 @@
namespace Wikibase\Test;
+use Wikibase\Change;
use Wikibase\ChangeNotificationJob;
/**
@@ -28,8 +29,8 @@
),
array( // #1: some changes
array(
- $this->getMock( 'Wikibase\Change' ),
- $this->getMock( 'Wikibase\Change' ),
+ $this->getMock( Change::class ),
+ $this->getMock( Change::class ),
),
'/^ChangeNotification/'
),
diff --git a/lib/tests/phpunit/DataValueFactoryTest.php
b/lib/tests/phpunit/DataValueFactoryTest.php
index 4860061..e491175 100644
--- a/lib/tests/phpunit/DataValueFactoryTest.php
+++ b/lib/tests/phpunit/DataValueFactoryTest.php
@@ -4,6 +4,7 @@
use DataValues\DataValueFactory;
use DataValues\UnDeserializableValue;
+use Deserializers\Deserializer;
use Deserializers\Exceptions\DeserializationException;
use PHPUnit_Framework_TestCase;
@@ -19,7 +20,7 @@
class DataValueFactoryTest extends PHPUnit_Framework_TestCase {
public function newInstance() {
- $deserializer = $this->getMock( 'Deserializers\Deserializer' );
+ $deserializer = $this->getMock( Deserializer::class );
$deserializer->expects( $this->any() )
->method( 'deserialize' )
->will( $this->returnCallback( function( array $data ) {
diff --git a/lib/tests/phpunit/EntityTypesTest.php
b/lib/tests/phpunit/EntityTypesTest.php
index 8cc15d2..4437b6c 100644
--- a/lib/tests/phpunit/EntityTypesTest.php
+++ b/lib/tests/phpunit/EntityTypesTest.php
@@ -2,7 +2,11 @@
namespace Wikibase\Lib\Tests;
+use Deserializers\Deserializer;
use PHPUnit_Framework_TestCase;
+use Serializers\Serializer;
+use Wikibase\DataModel\DeserializerFactory;
+use Wikibase\DataModel\SerializerFactory;
/**
* @covers WikibaseLib.entitytypes.php
@@ -16,26 +20,36 @@
return require __DIR__ . '/../../WikibaseLib.entitytypes.php';
}
+ /**
+ * @param string $entityType
+ *
+ * @return SerializerFactory
+ */
private function getSerializerFactroy( $entityType ) {
- $serializerFactory = $this->getMockBuilder(
'Wikibase\DataModel\SerializerFactory' )
+ $serializerFactory = $this->getMockBuilder(
SerializerFactory::class )
->disableOriginalConstructor()
->getMock();
$serializerFactory->expects( $this->once() )
->method( 'new' . $entityType . 'Serializer' )
- ->will( $this->returnValue( $this->getMock(
'Serializers\Serializer' ) ) );
+ ->will( $this->returnValue( $this->getMock(
Serializer::class ) ) );
return $serializerFactory;
}
+ /**
+ * @param string $entityType
+ *
+ * @return DeserializerFactory
+ */
private function getDeserializerFactroy( $entityType ) {
- $deserializerFactory = $this->getMockBuilder(
'Wikibase\DataModel\DeserializerFactory' )
+ $deserializerFactory = $this->getMockBuilder(
DeserializerFactory::class )
->disableOriginalConstructor()
->getMock();
$deserializerFactory->expects( $this->once() )
->method( 'new' . $entityType . 'Deserializer' )
- ->will( $this->returnValue( $this->getMock(
'Deserializers\Deserializer' ) ) );
+ ->will( $this->returnValue( $this->getMock(
Deserializer::class ) ) );
return $deserializerFactory;
}
diff --git a/lib/tests/phpunit/Interactors/TermIndexSearchInteractorTest.php
b/lib/tests/phpunit/Interactors/TermIndexSearchInteractorTest.php
index 06afb39..74fb2ef 100644
--- a/lib/tests/phpunit/Interactors/TermIndexSearchInteractorTest.php
+++ b/lib/tests/phpunit/Interactors/TermIndexSearchInteractorTest.php
@@ -8,6 +8,7 @@
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Term\Term;
use Wikibase\DataModel\Term\TermFallback;
+use Wikibase\LanguageFallbackChain;
use Wikibase\LanguageFallbackChainFactory;
use Wikibase\Lib\Interactors\TermIndexSearchInteractor;
use Wikibase\Lib\Interactors\TermSearchResult;
@@ -76,7 +77,7 @@
* @return BufferingTermLookup
*/
private function getMockBufferingTermLookup() {
- $mock = $this->getMockBuilder(
'Wikibase\Store\BufferingTermLookup' )
+ $mock = $this->getMockBuilder( BufferingTermLookup::class )
->disableOriginalConstructor()
->getMock();
$mock->expects( $this->any() )
@@ -113,7 +114,7 @@
* @return LanguageFallbackChainFactory
*/
private function getMockLanguageFallbackChainFactory() {
- $mockFactory = $this->getMockBuilder(
'Wikibase\LanguageFallbackChainFactory' )
+ $mockFactory = $this->getMockBuilder(
LanguageFallbackChainFactory::class )
->disableOriginalConstructor()
->getMock();
$mockFactory->expects( $this->any() )
@@ -124,8 +125,13 @@
return $mockFactory;
}
+ /**
+ * @param string $langCode
+ *
+ * @return LanguageFallbackChain
+ */
public function getMockLanguageFallbackChainFromLanguage( $langCode ) {
- $mockFallbackChain = $this->getMockBuilder(
'Wikibase\LanguageFallbackChain' )
+ $mockFallbackChain = $this->getMockBuilder(
LanguageFallbackChain::class )
->disableOriginalConstructor()
->getMock();
$mockFallbackChain->expects( $this->any() )
diff --git a/lib/tests/phpunit/Reporting/ReportingExceptionHandlerTest.php
b/lib/tests/phpunit/Reporting/ReportingExceptionHandlerTest.php
index 9170309..d006981 100644
--- a/lib/tests/phpunit/Reporting/ReportingExceptionHandlerTest.php
+++ b/lib/tests/phpunit/Reporting/ReportingExceptionHandlerTest.php
@@ -18,7 +18,7 @@
class ReportingExceptionHandlerTest extends \PHPUnit_Framework_TestCase {
public function testReportMessage() {
- $reporter = $this->getMock(
'Wikibase\Lib\Reporting\MessageReporter' );
+ $reporter = $this->getMock( MessageReporter::class );
$reporter->expects( $this->once() )
->method( 'reportMessage' );
diff --git a/lib/tests/phpunit/changes/EntityChangeTest.php
b/lib/tests/phpunit/changes/EntityChangeTest.php
index 69a4f62..823713d 100644
--- a/lib/tests/phpunit/changes/EntityChangeTest.php
+++ b/lib/tests/phpunit/changes/EntityChangeTest.php
@@ -7,6 +7,7 @@
use RecentChange;
use Revision;
use stdClass;
+use User;
use Wikibase\DataModel\Entity\EntityDocument;
use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Entity\Item;
@@ -193,7 +194,7 @@
}
public function testSetMetadataFromUser() {
- $user = $this->getMockBuilder( 'User' )
+ $user = $this->getMockBuilder( User::class )
->disableOriginalConstructor()
->getMock();
@@ -263,14 +264,14 @@
}
public function
testGivenEntityChangeWithoutObjectId_setRevisionInfoSetsObjectId() {
- $content = $this->getMockBuilder( 'Wikibase\ItemContent' )
+ $content = $this->getMockBuilder( ItemContent::class )
->disableOriginalConstructor()
->getMock();
$content->expects( $this->once() )
->method( 'getEntityId' )
->will( $this->returnValue( new ItemId( 'Q1' ) ) );
- $revision = $this->getMockBuilder( 'Revision' )
+ $revision = $this->getMockBuilder( Revision::class )
->disableOriginalConstructor()
->getMock();
$revision->expects( $this->once() )
diff --git a/lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php
b/lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php
index 4643d94..3d3e3fe 100644
--- a/lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php
+++ b/lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php
@@ -32,7 +32,7 @@
* @return PropertyDataTypeLookup
*/
private function getDataTypeLookup( $dataType = 'string' ) {
- $dataTypeLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup' );
+ $dataTypeLookup = $this->getMock( PropertyDataTypeLookup::class
);
$dataTypeLookup->expects( $this->any() )
->method( 'getDataTypeIdForProperty' )
@@ -48,7 +48,7 @@
* @return SnakFormatter
*/
private function makeSnakFormatter( $output, $format =
SnakFormatter::FORMAT_PLAIN ) {
- $formatter = $this->getMock( 'Wikibase\Lib\SnakFormatter' );
+ $formatter = $this->getMock( SnakFormatter::class );
$formatter->expects( $this->any() )
->method( 'formatSnak' )
diff --git a/lib/tests/phpunit/formatters/DispatchingValueFormatterTest.php
b/lib/tests/phpunit/formatters/DispatchingValueFormatterTest.php
index 1bda740..e72c2c7 100644
--- a/lib/tests/phpunit/formatters/DispatchingValueFormatterTest.php
+++ b/lib/tests/phpunit/formatters/DispatchingValueFormatterTest.php
@@ -5,6 +5,7 @@
use DataValues\StringValue;
use ValueFormatters\FormatterOptions;
use ValueFormatters\StringFormatter;
+use ValueFormatters\ValueFormatter;
use Wikibase\DataModel\Entity\EntityIdValue;
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\Lib\DispatchingValueFormatter;
@@ -62,12 +63,12 @@
}
public function formatProvider() {
- $stringFormatter = $this->getMock(
'ValueFormatters\ValueFormatter' );
+ $stringFormatter = $this->getMock( ValueFormatter::class );
$stringFormatter->expects( $this->any() )
->method( 'format' )
->will( $this->returnValue( 'VT:string' ) );
- $mediaFormatter = $this->getMock(
'ValueFormatters\ValueFormatter' );
+ $mediaFormatter = $this->getMock( ValueFormatter::class );
$mediaFormatter->expects( $this->any() )
->method( 'format' )
->will( $this->returnValue( 'VT:wikibase-entityid' ) );
@@ -104,12 +105,12 @@
}
public function formatValueProvider() {
- $stringFormatter = $this->getMock(
'ValueFormatters\ValueFormatter' );
+ $stringFormatter = $this->getMock( ValueFormatter::class );
$stringFormatter->expects( $this->any() )
->method( 'format' )
->will( $this->returnValue( 'VT:string' ) );
- $mediaFormatter = $this->getMock(
'ValueFormatters\ValueFormatter' );
+ $mediaFormatter = $this->getMock( ValueFormatter::class );
$mediaFormatter->expects( $this->any() )
->method( 'format' )
->will( $this->returnValue( 'PT:commonsMedia' ) );
diff --git a/lib/tests/phpunit/formatters/EntityIdHtmlLinkFormatterTest.php
b/lib/tests/phpunit/formatters/EntityIdHtmlLinkFormatterTest.php
index 42634bf..eb82876 100644
--- a/lib/tests/phpunit/formatters/EntityIdHtmlLinkFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EntityIdHtmlLinkFormatterTest.php
@@ -11,6 +11,7 @@
use Wikibase\DataModel\Term\Term;
use Wikibase\DataModel\Term\TermFallback;
use Wikibase\Lib\EntityIdHtmlLinkFormatter;
+use Wikibase\Lib\LanguageNameLookup;
use Wikibase\Lib\Store\EntityTitleLookup;
/**
@@ -32,7 +33,7 @@
* @return LabelDescriptionLookup
*/
private function getLabelDescriptionLookup( Term $term = null ) {
- $labelDescriptionLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\LabelDescriptionLookup' );
+ $labelDescriptionLookup = $this->getMock(
LabelDescriptionLookup::class );
$labelDescriptionLookup->expects( $this->any() )
->method( 'getLabel' )
->will( $this->returnValue( $term ?: new Term( 'xy', 'A
label' ) ) );
@@ -44,7 +45,7 @@
* @return LabelDescriptionLookup
*/
private function getLabelDescriptionLookupNoLabel() {
- $labelDescriptionLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\LabelDescriptionLookup' );
+ $labelDescriptionLookup = $this->getMock(
LabelDescriptionLookup::class );
$labelDescriptionLookup->expects( $this->any() )
->method( 'getLabel' )
->will( $this->throwException( new
LabelDescriptionLookupException(
@@ -61,7 +62,7 @@
* @return EntityTitleLookup
*/
private function newEntityTitleLookup( $exists = true ) {
- $entityTitleLookup = $this->getMock(
'Wikibase\Lib\Store\EntityTitleLookup' );
+ $entityTitleLookup = $this->getMock( EntityTitleLookup::class );
$entityTitleLookup->expects( $this->any() )
->method( 'getTitleForId' )
->will( $this->returnCallback( function ( EntityId $id
) use ( $exists ) {
@@ -105,7 +106,7 @@
$entityTitleLookup = $this->newEntityTitleLookup( $exists );
- $languageNameLookup = $this->getMock(
'Wikibase\Lib\LanguageNameLookup' );
+ $languageNameLookup = $this->getMock( LanguageNameLookup::class
);
$languageNameLookup->expects( $this->any() )
->method( 'getName' )
->will( $this->returnCallback( function( $languageCode
) {
diff --git a/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
b/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
index 6874184..cae0a33 100644
--- a/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
@@ -11,6 +11,7 @@
use Wikibase\DataModel\Entity\Property;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\Lib\EntityIdLinkFormatter;
+use Wikibase\Lib\Store\EntityTitleLookup;
/**
* @covers Wikibase\Lib\EntityIdLinkFormatter
@@ -59,7 +60,7 @@
}
private function newEntityIdLinkFormatter() {
- $titleLookup = $this->getMock(
'Wikibase\Lib\Store\EntityTitleLookup' );
+ $titleLookup = $this->getMock( EntityTitleLookup::class );
$titleLookup->expects( $this->any() )->method( 'getTitleForId' )
->will( $this->returnCallback( array( $this,
'getTitleForId' ) ) );
diff --git a/lib/tests/phpunit/formatters/EntityIdPlainLinkFormatterTest.php
b/lib/tests/phpunit/formatters/EntityIdPlainLinkFormatterTest.php
index cd3b663..3b4302c 100644
--- a/lib/tests/phpunit/formatters/EntityIdPlainLinkFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EntityIdPlainLinkFormatterTest.php
@@ -11,6 +11,7 @@
use Wikibase\DataModel\Entity\Property;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\Lib\EntityIdPlainLinkFormatter;
+use Wikibase\Lib\Store\EntityTitleLookup;
/**
* @covers Wikibase\Lib\EntityIdPlainLinkFormatter
@@ -60,7 +61,7 @@
}
private function newEntityIdLinkFormatter() {
- $titleLookup = $this->getMock(
'Wikibase\Lib\Store\EntityTitleLookup' );
+ $titleLookup = $this->getMock( EntityTitleLookup::class );
$titleLookup->expects( $this->any() )->method( 'getTitleForId' )
->will( $this->returnCallback( array( $this,
'getTitleForId' ) ) );
diff --git a/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
b/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
index 46da075..68309ff 100644
--- a/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
@@ -11,6 +11,7 @@
use Wikibase\DataModel\Entity\Property;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\Lib\EntityIdTitleFormatter;
+use Wikibase\Lib\Store\EntityTitleLookup;
/**
* @covers Wikibase\Lib\EntityIdTitleFormatter
@@ -61,7 +62,7 @@
}
protected function newEntityIdTitleFormatter() {
- $titleLookup = $this->getMock(
'Wikibase\Lib\Store\EntityTitleLookup' );
+ $titleLookup = $this->getMock( EntityTitleLookup::class );
$titleLookup->expects( $this->any() )->method( 'getTitleForId' )
->will( $this->returnCallback( array( $this,
'getTitleForId' ) ) );
diff --git a/lib/tests/phpunit/formatters/ErrorHandlingSnakFormatterTest.php
b/lib/tests/phpunit/formatters/ErrorHandlingSnakFormatterTest.php
index a1c0a7b..9bb22f5 100644
--- a/lib/tests/phpunit/formatters/ErrorHandlingSnakFormatterTest.php
+++ b/lib/tests/phpunit/formatters/ErrorHandlingSnakFormatterTest.php
@@ -36,7 +36,7 @@
* @return SnakFormatter
*/
private function getSnakFormatter( $throw = null ) {
- $formatter = $this->getMock( 'Wikibase\Lib\SnakFormatter' );
+ $formatter = $this->getMock( SnakFormatter::class );
$formatter->expects( $this->any() )
->method( 'getFormat' )
@@ -59,7 +59,7 @@
* @return ValueFormatter
*/
private function getValueFormatter() {
- $formatter = $this->getMock( 'ValueFormatters\ValueFormatter' );
+ $formatter = $this->getMock( ValueFormatter::class );
$formatter->expects( $this->any() )
->method( 'format' )
diff --git a/lib/tests/phpunit/formatters/EscapingSnakFormatterTest.php
b/lib/tests/phpunit/formatters/EscapingSnakFormatterTest.php
index 5ac6689..ecc1017 100644
--- a/lib/tests/phpunit/formatters/EscapingSnakFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EscapingSnakFormatterTest.php
@@ -27,7 +27,7 @@
* @return SnakFormatter
*/
private function getSnakFormatter( $output ) {
- $formatter = $this->getMock( 'Wikibase\Lib\SnakFormatter' );
+ $formatter = $this->getMock( SnakFormatter::class );
$formatter->expects( $this->any() )
->method( 'formatSnak' )
diff --git
a/lib/tests/phpunit/formatters/FormatterLabelDescriptionLookupFactoryTest.php
b/lib/tests/phpunit/formatters/FormatterLabelDescriptionLookupFactoryTest.php
index 51ee2b2..87fbac2 100644
---
a/lib/tests/phpunit/formatters/FormatterLabelDescriptionLookupFactoryTest.php
+++
b/lib/tests/phpunit/formatters/FormatterLabelDescriptionLookupFactoryTest.php
@@ -40,7 +40,7 @@
}
public function provideGetLabelDescriptionLookup() {
- $termLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\TermLookup' );
+ $termLookup = $this->getMock( TermLookup::class );
$termLookup->expects( $this->any() )
->method( 'getLabel' )
@@ -99,7 +99,7 @@
* @dataProvider provideGetLabelDescriptionLookup_failure
*/
public function testGetLabelDescriptionLookup_failure( FormatterOptions
$options ) {
- $termLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\TermLookup' );
+ $termLookup = $this->getMock( TermLookup::class );
$factory = new FormatterLabelDescriptionLookupFactory(
$termLookup );
$this->setExpectedException( 'InvalidArgumentException' );
diff --git
a/lib/tests/phpunit/formatters/HtmlExternalIdentifierFormatterTest.php
b/lib/tests/phpunit/formatters/HtmlExternalIdentifierFormatterTest.php
index 07276f1..ff83a7a 100644
--- a/lib/tests/phpunit/formatters/HtmlExternalIdentifierFormatterTest.php
+++ b/lib/tests/phpunit/formatters/HtmlExternalIdentifierFormatterTest.php
@@ -24,7 +24,7 @@
class HtmlExternalIdentifierFormatterTest extends \PHPUnit_Framework_TestCase {
public function provideFormatSnak() {
- $formatterUrlExpander = $this->getMock(
'Wikibase\Lib\SnakUrlExpander' );
+ $formatterUrlExpander = $this->getMock( SnakUrlExpander::class
);
$formatterUrlExpander->expects( $this->any() )
->method( 'expandUrl' )
@@ -77,7 +77,7 @@
* @dataProvider provideFormatSnak_ParameterTypeException
*/
public function testFormatSnak_ParameterTypeException( $snak ) {
- $urlExpander = $this->getMock( 'Wikibase\Lib\SnakUrlExpander' );
+ $urlExpander = $this->getMock( SnakUrlExpander::class );
$formatter = new HtmlExternalIdentifierFormatter( $urlExpander
);
$this->setExpectedException(
'Wikimedia\Assert\ParameterTypeException' );
@@ -85,7 +85,7 @@
}
public function testGetFormat() {
- $urlExpander = $this->getMock( 'Wikibase\Lib\SnakUrlExpander' );
+ $urlExpander = $this->getMock( SnakUrlExpander::class );
$formatter = new HtmlExternalIdentifierFormatter( $urlExpander
);
$this->assertSame( SnakFormatter::FORMAT_HTML,
$formatter->getFormat() );
diff --git a/lib/tests/phpunit/formatters/HtmlTimeFormatterTest.php
b/lib/tests/phpunit/formatters/HtmlTimeFormatterTest.php
index 98d3249..3d27ea8 100644
--- a/lib/tests/phpunit/formatters/HtmlTimeFormatterTest.php
+++ b/lib/tests/phpunit/formatters/HtmlTimeFormatterTest.php
@@ -30,7 +30,7 @@
$options = new FormatterOptions();
$options->setOption( ValueFormatter::OPT_LANG, 'qqx' );
- $dateTimeFormatter = $this->getMock(
'ValueFormatters\ValueFormatter' );
+ $dateTimeFormatter = $this->getMock( ValueFormatter::class );
$dateTimeFormatter->expects( $this->any() )
->method( 'format' )
diff --git a/lib/tests/phpunit/formatters/MessageSnakFormatterTest.php
b/lib/tests/phpunit/formatters/MessageSnakFormatterTest.php
index c7f51c7..4ac4103 100644
--- a/lib/tests/phpunit/formatters/MessageSnakFormatterTest.php
+++ b/lib/tests/phpunit/formatters/MessageSnakFormatterTest.php
@@ -3,6 +3,7 @@
namespace Wikibase\Lib\Test;
use DataValues\StringValue;
+use Message;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Snak\PropertyNoValueSnak;
use Wikibase\DataModel\Snak\PropertySomeValueSnak;
@@ -35,7 +36,7 @@
* @return MessageSnakFormatter
*/
private function getFormatter( $snakType, $format ) {
- $message = $this->getMockBuilder( 'Message' )
+ $message = $this->getMockBuilder( Message::class )
->setConstructorArgs( array( 'message' ) )
->getMock();
diff --git a/lib/tests/phpunit/formatters/MonolingualHtmlFormatterTest.php
b/lib/tests/phpunit/formatters/MonolingualHtmlFormatterTest.php
index 1f0f2f7..f89e024 100644
--- a/lib/tests/phpunit/formatters/MonolingualHtmlFormatterTest.php
+++ b/lib/tests/phpunit/formatters/MonolingualHtmlFormatterTest.php
@@ -6,6 +6,7 @@
use ValueFormatters\FormatterOptions;
use ValueFormatters\ValueFormatter;
use Wikibase\Formatters\MonolingualHtmlFormatter;
+use Wikibase\Lib\LanguageNameLookup;
/**
* @covers Wikibase\Formatters\MonolingualHtmlFormatter
@@ -25,7 +26,7 @@
* @dataProvider monolingualHtmlFormatProvider
*/
public function testFormat( $value, $options, $pattern, $not = '' ) {
- $languageNameLookup = $this->getMock(
'Wikibase\Lib\LanguageNameLookup' );
+ $languageNameLookup = $this->getMock( LanguageNameLookup::class
);
$languageNameLookup->expects( $this->any() )
->method( 'getName' )
->will( $this->returnValue( 'Deutsch' ) );
diff --git
a/lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php
b/lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php
index 08844dd..6345d0b 100644
--- a/lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php
+++ b/lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php
@@ -10,6 +10,7 @@
use ValueFormatters\StringFormatter;
use ValueFormatters\ValueFormatter;
use Wikibase\DataModel\Entity\PropertyId;
+use Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup;
use Wikibase\DataModel\Snak\PropertyValueSnak;
use Wikibase\DataModel\Snak\Snak;
use Wikibase\LanguageFallbackChainFactory;
@@ -48,9 +49,7 @@
new LanguageFallbackChainFactory()
);
- $dataTypeLookup = $this->getMock(
-
'Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup'
- );
+ $dataTypeLookup = $this->getMock( PropertyDataTypeLookup::class
);
$dataTypeLookup->expects( $this->any() )
->method( 'getDataTypeIdForProperty' )
->will( $this->returnValue( $dataType ) );
@@ -63,8 +62,13 @@
);
}
+ /**
+ * @param string $format
+ *
+ * @return ValueFormatter
+ */
public function makeMockValueFormatter( $format ) {
- $mock = $this->getMock( 'ValueFormatters\ValueFormatter' );
+ $mock = $this->getMock( ValueFormatter::class );
$mock->expects( $this->any() )
->method( 'format' )
@@ -77,8 +81,13 @@
return $mock;
}
+ /**
+ * @param string $format
+ *
+ * @return SnakFormatter
+ */
public function makeMockSnakFormatter( $format ) {
- $mock = $this->getMock( 'Wikibase\Lib\SnakFormatter' );
+ $mock = $this->getMock( SnakFormatter::class );
$mock->expects( $this->any() )
->method( 'formatSnak' )
@@ -190,7 +199,7 @@
$factory = new OutputFormatSnakFormatterFactory(
array(),
$valueFormatterFactory,
- $this->getMock(
'Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup' ),
+ $this->getMock( PropertyDataTypeLookup::class ),
new DataTypeFactory( array() )
);
$factory->getSnakFormatter( SnakFormatter::FORMAT_PLAIN, new
FormatterOptions() );
diff --git
a/lib/tests/phpunit/formatters/OutputFormatValueFormatterFactoryTest.php
b/lib/tests/phpunit/formatters/OutputFormatValueFormatterFactoryTest.php
index 14dac81..7a76c1b 100644
--- a/lib/tests/phpunit/formatters/OutputFormatValueFormatterFactoryTest.php
+++ b/lib/tests/phpunit/formatters/OutputFormatValueFormatterFactoryTest.php
@@ -55,16 +55,6 @@
);
}
- public function makeMockValueFormatter( $value ) {
- $mock = $this->getMock( 'ValueFormatters\ValueFormatter' );
-
- $mock->expects( $this->atLeastOnce() )
- ->method( 'format' )
- ->will( $this->returnValue( $value ) );
-
- return $mock;
- }
-
private function newOutputFormatValueFormatterFactory() {
$factoryCallbacks = array(
'VT:string' => function( $format, FormatterOptions
$options ) {
diff --git a/lib/tests/phpunit/formatters/PropertyValueSnakFormatterTest.php
b/lib/tests/phpunit/formatters/PropertyValueSnakFormatterTest.php
index 72c9fbc..9e55187 100644
--- a/lib/tests/phpunit/formatters/PropertyValueSnakFormatterTest.php
+++ b/lib/tests/phpunit/formatters/PropertyValueSnakFormatterTest.php
@@ -64,7 +64,7 @@
new PropertyDataTypeLookupException( new
PropertyId( 'P666' ) ) );
}
- $typeLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup' );
+ $typeLookup = $this->getMock( PropertyDataTypeLookup::class );
$typeLookup->expects( $this->atLeastOnce() )
->method( 'getDataTypeIdForProperty' )
->will( $getDataTypeIdForPropertyResult );
@@ -86,7 +86,7 @@
new OutOfBoundsException( 'unknown datatype ' .
$dataType ) );
}
- $typeFactory = $this->getMockBuilder(
'DataTypes\DataTypeFactory' )
+ $typeFactory = $this->getMockBuilder( DataTypeFactory::class )
->disableOriginalConstructor()
->getMock();
@@ -129,7 +129,7 @@
}
private function getMockFormatter( $value ) {
- $formatter = $this->getMock( 'ValueFormatters\ValueFormatter' );
+ $formatter = $this->getMock( ValueFormatter::class );
$formatter->expects( $this->any() )
->method( 'format' )
->will( $this->returnValue( $value ) );
@@ -219,10 +219,10 @@
}
private function getDummyPropertyValueSnakFormatter( $format = 'test' )
{
- $typeLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup' );
+ $typeLookup = $this->getMock( PropertyDataTypeLookup::class );
$typeLookup->expects( $this->never() )->method(
'getDataTypeIdForProperty' );
- $typeFactory = $this->getMockBuilder(
'DataTypes\DataTypeFactory' )
+ $typeFactory = $this->getMockBuilder( DataTypeFactory::class )
->disableOriginalConstructor()
->getMock();
diff --git a/lib/tests/phpunit/formatters/QuantityDetailsFormatterTest.php
b/lib/tests/phpunit/formatters/QuantityDetailsFormatterTest.php
index 470c250..03ffa22 100644
--- a/lib/tests/phpunit/formatters/QuantityDetailsFormatterTest.php
+++ b/lib/tests/phpunit/formatters/QuantityDetailsFormatterTest.php
@@ -7,6 +7,7 @@
use PHPUnit_Framework_TestCase;
use ValueFormatters\BasicNumberLocalizer;
use ValueFormatters\NumberLocalizer;
+use ValueFormatters\ValueFormatter;
use Wikibase\Lib\QuantityDetailsFormatter;
/**
@@ -23,7 +24,7 @@
class QuantityDetailsFormatterTest extends PHPUnit_Framework_TestCase {
private function newFormatter( NumberLocalizer $numberLocalizer = null
) {
- $vocabularyUriFormatter = $this->getMock(
'ValueFormatters\ValueFormatter' );
+ $vocabularyUriFormatter = $this->getMock( ValueFormatter::class
);
$vocabularyUriFormatter->expects( $this->any() )
->method( 'format' )
->will( $this->returnCallback( function( $value ) {
@@ -98,7 +99,7 @@
}
public function testGivenHtmlCharacters_formatEscapesHtmlCharacters() {
- $unitFormatter = $this->getMock(
'ValueFormatters\NumberLocalizer' );
+ $unitFormatter = $this->getMock( NumberLocalizer::class );
$unitFormatter->expects( $this->any() )
->method( 'localizeNumber' )
->will( $this->returnValue( '<a>+2</a>' ) );
diff --git a/lib/tests/phpunit/formatters/TimeDetailsFormatterTest.php
b/lib/tests/phpunit/formatters/TimeDetailsFormatterTest.php
index 2eeb481..094e1ed 100644
--- a/lib/tests/phpunit/formatters/TimeDetailsFormatterTest.php
+++ b/lib/tests/phpunit/formatters/TimeDetailsFormatterTest.php
@@ -31,7 +31,7 @@
$options = new FormatterOptions();
$options->setOption( ValueFormatter::OPT_LANG, 'qqx' );
- $timeFormatter = $this->getMock(
'ValueFormatters\ValueFormatter' );
+ $timeFormatter = $this->getMock( ValueFormatter::class );
$timeFormatter->expects( $this->any() )
->method( 'format' )
->will( $this->returnValue( $formattedHeading ) );
diff --git a/lib/tests/phpunit/formatters/VocabularyUriFormatterTest.php
b/lib/tests/phpunit/formatters/VocabularyUriFormatterTest.php
index 1cdbe97..4c535a0 100644
--- a/lib/tests/phpunit/formatters/VocabularyUriFormatterTest.php
+++ b/lib/tests/phpunit/formatters/VocabularyUriFormatterTest.php
@@ -5,6 +5,7 @@
use PHPUnit_Framework_TestCase;
use Wikibase\DataModel\Entity\BasicEntityIdParser;
use Wikibase\DataModel\Entity\EntityId;
+use Wikibase\DataModel\Services\Lookup\LabelDescriptionLookup;
use Wikibase\DataModel\Services\Lookup\LabelDescriptionLookupException;
use Wikibase\DataModel\Term\Term;
use Wikibase\Lib\VocabularyUriFormatter;
@@ -39,7 +40,7 @@
* @dataProvider unitProvider
*/
public function testFormat( $unit, $expected ) {
- $labelLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\LabelDescriptionLookup' );
+ $labelLookup = $this->getMock( LabelDescriptionLookup::class );
$labelLookup->expects( $this->any() )
->method( 'getLabel' )
->will( $this->returnCallback( function( EntityId $id )
{
diff --git a/lib/tests/phpunit/formatters/WikibaseSnakFormatterBuildersTest.php
b/lib/tests/phpunit/formatters/WikibaseSnakFormatterBuildersTest.php
index 92e7114..9e2927c 100644
--- a/lib/tests/phpunit/formatters/WikibaseSnakFormatterBuildersTest.php
+++ b/lib/tests/phpunit/formatters/WikibaseSnakFormatterBuildersTest.php
@@ -12,6 +12,7 @@
use Wikibase\DataModel\Snak\Snak;
use Wikibase\Lib\SnakFormatter;
use Wikibase\Lib\WikibaseSnakFormatterBuilders;
+use Wikibase\Lib\WikibaseValueFormatterBuilders;
use Wikibase\PropertyInfoStore;
use Wikibase\Test\MockPropertyInfoStore;
@@ -34,7 +35,7 @@
private function getWikibaseSnakFormatterBuilders() {
$p1 = new PropertyId( 'P1' );
- $valueFormatterBuilders = $this->getMockBuilder(
'Wikibase\Lib\WikibaseValueFormatterBuilders' )
+ $valueFormatterBuilders = $this->getMockBuilder(
WikibaseValueFormatterBuilders::class )
->disableOriginalConstructor()
->getMock();
diff --git
a/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
b/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
index fc1d803..1ab3e15 100644
--- a/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
+++ b/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
@@ -20,9 +20,12 @@
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Entity\BasicEntityIdParser;
+use Wikibase\DataModel\Services\Lookup\LabelDescriptionLookup;
+use Wikibase\DataModel\Services\Lookup\TermLookup;
use Wikibase\DataModel\Term\Term;
use Wikibase\LanguageFallbackChainFactory;
use Wikibase\Lib\FormatterLabelDescriptionLookupFactory;
+use Wikibase\Lib\LanguageNameLookup;
use Wikibase\Lib\SnakFormatter;
use Wikibase\Lib\Store\EntityTitleLookup;
use Wikibase\Lib\WikibaseValueFormatterBuilders;
@@ -53,7 +56,7 @@
* @return WikibaseValueFormatterBuilders
*/
private function newWikibaseValueFormatterBuilders( EntityTitleLookup
$entityTitleLookup ) {
- $termLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\TermLookup' );
+ $termLookup = $this->getMock( TermLookup::class );
$termLookup->expects( $this->any() )
->method( 'getLabel' )
@@ -75,7 +78,7 @@
);
} ) );
- $languageNameLookup = $this->getMock(
'Wikibase\Lib\LanguageNameLookup' );
+ $languageNameLookup = $this->getMock( LanguageNameLookup::class
);
$languageNameLookup->expects( $this->any() )
->method( 'getName' )
->will( $this->returnValue( 'Deutsch' ) );
@@ -104,7 +107,7 @@
* @return EntityTitleLookup
*/
private function getTitleLookup() {
- $titleLookup = $this->getMock(
'Wikibase\Lib\Store\EntityTitleLookup' );
+ $titleLookup = $this->getMock( EntityTitleLookup::class );
$titleLookup->expects( $this->any() )
->method( 'getTitleForId' )
@@ -424,7 +427,7 @@
}
public function provideNewFormatter_LabelDescriptionLookupOption() {
- $labelDescriptionLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\LabelDescriptionLookup' );
+ $labelDescriptionLookup = $this->getMock(
LabelDescriptionLookup::class );
$labelDescriptionLookup->expects( $this->any() )
->method( 'getLabel' )
->will( $this->returnValue( new Term( 'xy', 'Custom
LabelDescriptionLookup' ) ) );
diff --git
a/lib/tests/phpunit/formatters/WikitextExternalIdentifierFormatterTest.php
b/lib/tests/phpunit/formatters/WikitextExternalIdentifierFormatterTest.php
index d96961a..a0f2b5d 100644
--- a/lib/tests/phpunit/formatters/WikitextExternalIdentifierFormatterTest.php
+++ b/lib/tests/phpunit/formatters/WikitextExternalIdentifierFormatterTest.php
@@ -24,7 +24,7 @@
class WikitextExternalIdentifierFormatterTest extends
\PHPUnit_Framework_TestCase {
public function provideFormatSnak() {
- $formatterUrlExpander = $this->getMock(
'Wikibase\Lib\SnakUrlExpander' );
+ $formatterUrlExpander = $this->getMock( SnakUrlExpander::class
);
$formatterUrlExpander->expects( $this->any() )
->method( 'expandUrl' )
@@ -85,7 +85,7 @@
* @dataProvider provideFormatSnak_ParameterTypeException
*/
public function testFormatSnak_ParameterTypeException( $snak ) {
- $urlExpander = $this->getMock( 'Wikibase\Lib\SnakUrlExpander' );
+ $urlExpander = $this->getMock( SnakUrlExpander::class );
$formatter = new WikitextExternalIdentifierFormatter(
$urlExpander );
$this->setExpectedException(
'Wikimedia\Assert\ParameterTypeException' );
@@ -93,7 +93,7 @@
}
public function testGetFormat() {
- $urlExpander = $this->getMock( 'Wikibase\Lib\SnakUrlExpander' );
+ $urlExpander = $this->getMock( SnakUrlExpander::class );
$formatter = new WikitextExternalIdentifierFormatter(
$urlExpander );
$this->assertSame( SnakFormatter::FORMAT_WIKI,
$formatter->getFormat() );
diff --git a/lib/tests/phpunit/includes/modules/RepoAccessModuleTest.php
b/lib/tests/phpunit/includes/modules/RepoAccessModuleTest.php
index 07bef94..ec25a63 100644
--- a/lib/tests/phpunit/includes/modules/RepoAccessModuleTest.php
+++ b/lib/tests/phpunit/includes/modules/RepoAccessModuleTest.php
@@ -21,7 +21,7 @@
* @return ResourceLoaderContext
*/
private function getContext() {
- return $this->getMockBuilder( 'ResourceLoaderContext' )
+ return $this->getMockBuilder( ResourceLoaderContext::class )
->disableOriginalConstructor()
->getMock();
}
diff --git a/lib/tests/phpunit/includes/modules/SitesModuleTest.php
b/lib/tests/phpunit/includes/modules/SitesModuleTest.php
index b5f2b53..6129abc 100644
--- a/lib/tests/phpunit/includes/modules/SitesModuleTest.php
+++ b/lib/tests/phpunit/includes/modules/SitesModuleTest.php
@@ -21,7 +21,7 @@
* @return ResourceLoaderContext
*/
private function getContext() {
- return $this->getMockBuilder( 'ResourceLoaderContext' )
+ return $this->getMockBuilder( ResourceLoaderContext::class )
->disableOriginalConstructor()
->getMock();
}
diff --git a/lib/tests/phpunit/includes/modules/SitesModuleWorkerTest.php
b/lib/tests/phpunit/includes/modules/SitesModuleWorkerTest.php
index c0566bf..084a032 100644
--- a/lib/tests/phpunit/includes/modules/SitesModuleWorkerTest.php
+++ b/lib/tests/phpunit/includes/modules/SitesModuleWorkerTest.php
@@ -8,6 +8,7 @@
use PHPUnit_Framework_TestCase;
use Site;
use SiteList;
+use SiteStore;
use Wikibase\Lib\SitesModuleWorker;
use Wikibase\SettingsArray;
@@ -40,7 +41,7 @@
array $specialGroups = array(),
BagOStuff $cache = null
) {
- $siteStore = $this->getMock( 'SiteStore' );
+ $siteStore = $this->getMock( SiteStore::class );
$siteStore->expects( $this->any() )
->method( 'getSites' )
->will( $this->returnValue( new SiteList( $sites ) ) );
diff --git a/lib/tests/phpunit/includes/serialization/CallbackFactoryTest.php
b/lib/tests/phpunit/includes/serialization/CallbackFactoryTest.php
index b50600f..5898092 100644
--- a/lib/tests/phpunit/includes/serialization/CallbackFactoryTest.php
+++ b/lib/tests/phpunit/includes/serialization/CallbackFactoryTest.php
@@ -3,6 +3,7 @@
namespace Wikibase\Lib\Tests\Serialization;
use PHPUnit_Framework_TestCase;
+use Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup;
use Wikibase\Lib\Serialization\CallbackFactory;
/**
@@ -16,8 +17,11 @@
*/
class CallbackFactoryTest extends PHPUnit_Framework_TestCase {
+ /**
+ * @return PropertyDataTypeLookup
+ */
private function getPropertyDataTypeLookup() {
- $mock = $this->getMock(
'Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup' );
+ $mock = $this->getMock( PropertyDataTypeLookup::class );
$mock->expects( $this->once() )
->method( 'getDataTypeIdForProperty' )
diff --git a/lib/tests/phpunit/store/BufferingTermLookupTest.php
b/lib/tests/phpunit/store/BufferingTermLookupTest.php
index 669c55c..07a5756 100644
--- a/lib/tests/phpunit/store/BufferingTermLookupTest.php
+++ b/lib/tests/phpunit/store/BufferingTermLookupTest.php
@@ -84,7 +84,7 @@
) ),
);
- $termIndex = $this->getMock( 'Wikibase\TermIndex' );
+ $termIndex = $this->getMock( TermIndex::class );
$termIndex->expects( $this->exactly( $getTermsOfEntityCalls ) )
->method( 'getTermsOfEntity' )
diff --git a/lib/tests/phpunit/store/CachingSiteLinkLookupTest.php
b/lib/tests/phpunit/store/CachingSiteLinkLookupTest.php
index 0e808c8..20400c8 100644
--- a/lib/tests/phpunit/store/CachingSiteLinkLookupTest.php
+++ b/lib/tests/phpunit/store/CachingSiteLinkLookupTest.php
@@ -7,6 +7,7 @@
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\DataModel\SiteLink;
use Wikibase\Lib\Store\CachingSiteLinkLookup;
+use Wikibase\Lib\Store\SiteLinkLookup;
/**
* @covers Wikibase\Lib\Store\CachingSiteLinkLookup
@@ -25,7 +26,7 @@
$cache->set( 'wikibase:sitelinks-by-page:foowiki:bar', 'Q42' );
$cachingSiteLinkLookup = new CachingSiteLinkLookup(
- $this->getMock( 'Wikibase\Lib\Store\SiteLinkLookup' ),
+ $this->getMock( SiteLinkLookup::class ),
$cache
);
@@ -37,7 +38,7 @@
public function testGetItemIdForLink_cacheMiss() {
$cache = new HashBagOStuff();
- $lookup = $this->getMock( 'Wikibase\Lib\Store\SiteLinkLookup' );
+ $lookup = $this->getMock( SiteLinkLookup::class );
$lookup->expects( $this->once() )
->method( 'getItemIdForLink' )
->with( 'foowiki', 'bar' )
@@ -66,7 +67,7 @@
$cache->set( 'wikibase:sitelinks-by-page:foowiki:bar', 'Q42' );
$cachingSiteLinkLookup = new CachingSiteLinkLookup(
- $this->getMock( 'Wikibase\Lib\Store\SiteLinkLookup' ),
+ $this->getMock( SiteLinkLookup::class ),
$cache
);
@@ -79,7 +80,7 @@
public function testGetItemIdForSiteLink_cacheMiss() {
$siteLink = new SiteLink( 'foowiki', 'bar' );
$cache = new HashBagOStuff();
- $lookup = $this->getMock( 'Wikibase\Lib\Store\SiteLinkLookup' );
+ $lookup = $this->getMock( SiteLinkLookup::class );
$lookup->expects( $this->once() )
->method( 'getItemIdForLink' )
->with( 'foowiki', 'bar' )
@@ -109,7 +110,7 @@
$cache->set( 'wikibase:sitelinks:Q42', $siteLinks );
$cachingSiteLinkLookup = new CachingSiteLinkLookup(
- $this->getMock( 'Wikibase\Lib\Store\SiteLinkLookup' ),
+ $this->getMock( SiteLinkLookup::class ),
$cache
);
@@ -124,7 +125,7 @@
$q42 = new ItemId( 'Q42' );
$cache = new HashBagOStuff();
- $lookup = $this->getMock( 'Wikibase\Lib\Store\SiteLinkLookup' );
+ $lookup = $this->getMock( SiteLinkLookup::class );
$lookup->expects( $this->once() )
->method( 'getSiteLinksForItem' )
->with( $q42 )
@@ -143,7 +144,7 @@
public function testGetLinks() {
// getLinks is a simple pass through
- $lookup = $this->getMock( 'Wikibase\Lib\Store\SiteLinkLookup' );
+ $lookup = $this->getMock( SiteLinkLookup::class );
$lookup->expects( $this->once() )
->method( 'getLinks' )
->with( array( 1 ), array( 'a' ), array( 'b' ) )
diff --git a/lib/tests/phpunit/store/FieldPropertyInfoProviderTest.php
b/lib/tests/phpunit/store/FieldPropertyInfoProviderTest.php
index b4f12ba..2edec03 100644
--- a/lib/tests/phpunit/store/FieldPropertyInfoProviderTest.php
+++ b/lib/tests/phpunit/store/FieldPropertyInfoProviderTest.php
@@ -5,6 +5,7 @@
use PHPUnit_Framework_TestCase;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\Lib\FieldPropertyInfoProvider;
+use Wikibase\PropertyInfoStore;
/**
* @covers Wikibase\Lib\FieldPropertyInfoProvider
@@ -24,7 +25,7 @@
public function testGetPropertyInfo( $info, $key, $expected ) {
$propertyId = new PropertyId( 'P1' );
- $lookup = $this->getMock( 'Wikibase\PropertyInfoStore' );
+ $lookup = $this->getMock( PropertyInfoStore::class );
$lookup->expects( $this->once() )
->method( 'getPropertyInfo' )
->with( $propertyId )
diff --git
a/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
b/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
index 83c078f..5857777 100644
---
a/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
+++
b/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
@@ -5,6 +5,8 @@
use Language;
use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Entity\ItemId;
+use Wikibase\DataModel\Services\Lookup\TermLookup;
+use Wikibase\DataModel\Services\Term\TermBuffer;
use Wikibase\LanguageFallbackChainFactory;
use Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory;
@@ -20,8 +22,11 @@
*/
class LanguageFallbackLabelDescriptionLookupFactoryTest extends
\PHPUnit_Framework_TestCase {
+ /**
+ * @return TermLookup
+ */
private function getTermLookupMock() {
- $termLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\TermLookup' );
+ $termLookup = $this->getMock( TermLookup::class );
$termLookup->expects( $this->any() )
->method( 'getLabel' )
->will( $this->returnCallback( function( EntityId $id )
{
@@ -37,8 +42,11 @@
return $termLookup;
}
+ /**
+ * @return TermBuffer
+ */
private function getTermBufferMock() {
- $termBuffer = $this->getMock(
'Wikibase\DataModel\Services\Term\TermBuffer' );
+ $termBuffer = $this->getMock( TermBuffer::class );
$termBuffer->expects( $this->once() )
->method( 'prefetchTerms' )
->with(
diff --git
a/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupTest.php
b/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupTest.php
index add0e65..fcde4d1 100644
--- a/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupTest.php
+++ b/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupTest.php
@@ -5,6 +5,7 @@
use MediaWikiTestCase;
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\DataModel\Term\TermFallback;
+use Wikibase\LanguageFallbackChain;
use Wikibase\Lib\Store\EntityTermLookup;
use Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookup;
use Wikibase\TermIndexEntry;
@@ -90,8 +91,13 @@
$this->assertNull( $labelDescriptionLookup->getDescription( new
ItemId( 'Q116' ) ) );
}
+ /**
+ * @param string $languageCode
+ *
+ * @return LanguageFallbackChain
+ */
private function getLanguageFallbackChain( $languageCode ) {
- $languageFallbackChain = $this->getMockBuilder(
'Wikibase\LanguageFallbackChain' )
+ $languageFallbackChain = $this->getMockBuilder(
LanguageFallbackChain::class )
->disableOriginalConstructor()
->getMock();
diff --git
a/lib/tests/phpunit/store/PrefetchingWikiPageEntityMetaDataAccessorTest.php
b/lib/tests/phpunit/store/PrefetchingWikiPageEntityMetaDataAccessorTest.php
index e683466..c2585d6 100644
--- a/lib/tests/phpunit/store/PrefetchingWikiPageEntityMetaDataAccessorTest.php
+++ b/lib/tests/phpunit/store/PrefetchingWikiPageEntityMetaDataAccessorTest.php
@@ -10,6 +10,7 @@
use Wikibase\EntityRevision;
use Wikibase\Lib\Store\EntityRevisionLookup;
use Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor;
+use Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor;
/**
* @covers Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor
@@ -29,7 +30,7 @@
$q2 = new ItemId( 'Q2' );
$q3 = new ItemId( 'Q3' );
- $lookup = $this->getMock(
'Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor' );
+ $lookup = $this->getMock( WikiPageEntityMetaDataAccessor::class
);
$lookup->expects( $this->once() )
->method( 'loadRevisionInformation' )
->with( array(
@@ -77,7 +78,7 @@
'Q3' => '~=[,,_,,]:3'
);
- $lookup = $this->getMock(
'Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor' );
+ $lookup = $this->getMock( WikiPageEntityMetaDataAccessor::class
);
$lookup->expects( $this->once() )
->method( 'loadRevisionInformation' )
->with( array(
@@ -108,7 +109,7 @@
'Q2' => 'cat',
);
- $lookup = $this->getMock(
'Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor' );
+ $lookup = $this->getMock( WikiPageEntityMetaDataAccessor::class
);
$lookup->expects( $this->once() )
->method( 'loadRevisionInformation' )
->with( array(
@@ -137,7 +138,7 @@
$fromMaster = EntityRevisionLookup::LATEST_FROM_MASTER;
$fromSlave = EntityRevisionLookup::LATEST_FROM_SLAVE;
- $lookup = $this->getMock(
'Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor' );
+ $lookup = $this->getMock( WikiPageEntityMetaDataAccessor::class
);
$lookup->expects( $this->exactly( 3 ) )
->method( 'loadRevisionInformation' )
->will( $this->returnCallback( function( array
$entityIds, $mode ) {
@@ -197,7 +198,7 @@
// lookup function.
$q1 = new ItemId( 'Q1' );
- $lookup = $this->getMock(
'Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor' );
+ $lookup = $this->getMock( WikiPageEntityMetaDataAccessor::class
);
$lookup->expects( $this->once() )
->method( 'loadRevisionInformationByRevisionId' )
->with( $q1, 123 )
@@ -221,7 +222,7 @@
$fromSlave = EntityRevisionLookup::LATEST_FROM_SLAVE;
$q1 = new ItemId( 'Q1' );
- $lookup = $this->getMock(
'Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataAccessor' );
+ $lookup = $this->getMock( WikiPageEntityMetaDataAccessor::class
);
$lookup->expects( $this->exactly( 2 ) )
->method( 'loadRevisionInformation' )
->with( array( $q1->getSerialization() => $q1 ) )
diff --git a/lib/tests/phpunit/store/RevisionBasedEntityLookupTest.php
b/lib/tests/phpunit/store/RevisionBasedEntityLookupTest.php
index 0a7f5c2..3920480 100644
--- a/lib/tests/phpunit/store/RevisionBasedEntityLookupTest.php
+++ b/lib/tests/phpunit/store/RevisionBasedEntityLookupTest.php
@@ -89,8 +89,11 @@
$entityLookup->getEntity( new ItemId( 'Q1' ) );
}
+ /**
+ * @return EntityRevisionLookup
+ */
private function newEntityLookupExceptionThrowingRevisionLookup() {
- $revisionLookup = $this->getMock(
'Wikibase\Lib\Store\EntityRevisionLookup' );
+ $revisionLookup = $this->getMock( EntityRevisionLookup::class );
$revisionLookup->expects( $this->any() )
->method( 'getEntityRevision' )
@@ -123,8 +126,11 @@
$entityLookup->hasEntity( new ItemId( 'Q1' ) );
}
+ /**
+ * @return EntityRevisionLookup
+ */
private function newBadExceptionThrowingRevisionLookup() {
- $revisionLookup = $this->getMock(
'Wikibase\Lib\Store\EntityRevisionLookup' );
+ $revisionLookup = $this->getMock( EntityRevisionLookup::class );
$revisionLookup->expects( $this->any() )
->method( 'getEntityRevision' )
diff --git a/lib/tests/phpunit/store/Sql/ChangeLookupTest.php
b/lib/tests/phpunit/store/Sql/ChangeLookupTest.php
index 144dbc1..016f2a3 100644
--- a/lib/tests/phpunit/store/Sql/ChangeLookupTest.php
+++ b/lib/tests/phpunit/store/Sql/ChangeLookupTest.php
@@ -2,6 +2,7 @@
namespace Wikibase\Test;
+use Wikibase\Change;
use Wikibase\EntityChange;
use Wikibase\Lib\Store\ChangeLookup;
use Wikibase\Repo\Store\Sql\SqlChangeStore;
@@ -20,7 +21,7 @@
class ChangeLookupTest extends \MediaWikiTestCase {
public function testGetRecordId() {
- $change = $this->getMock( 'Wikibase\Change' );
+ $change = $this->getMock( Change::class );
$change->expects( $this->once() )
->method( 'getId' )
->will( $this->returnValue( 42 ) );
diff --git a/lib/tests/phpunit/store/Sql/TermSqlIndexTest.php
b/lib/tests/phpunit/store/Sql/TermSqlIndexTest.php
index 6097711..c07d2af 100644
--- a/lib/tests/phpunit/store/Sql/TermSqlIndexTest.php
+++ b/lib/tests/phpunit/store/Sql/TermSqlIndexTest.php
@@ -282,7 +282,7 @@
return array(
array( $expectedTerms, $item ),
array( array(), new Item() ),
- array( array(), $this->getMock(
'Wikibase\DataModel\Entity\EntityDocument' ) )
+ array( array(), $this->getMock( EntityDocument::class )
)
);
}
--
To view, visit https://gerrit.wikimedia.org/r/275380
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9fd51401d4b48940eeeafc430addbe4091afb8bc
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Bene <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits