diff --git a/repo/tests/phpunit/includes/Hooks/EditFilterHookRunnerTest.php b/repo/tests/phpunit/includes/Hooks/EditFilterHookRunnerTest.php index 80b35548a43..84e90c85320 100644 --- a/repo/tests/phpunit/includes/Hooks/EditFilterHookRunnerTest.php +++ b/repo/tests/phpunit/includes/Hooks/EditFilterHookRunnerTest.php @@ -76,7 +76,7 @@ public function testRun_noHooksRegisteredGoodStatus() { $this->assertStatusGood( $status ); } - public function runData() { + public static function runData() { return [ 'good existing item' => [ Status::newGood(), diff --git a/repo/tests/phpunit/includes/Hooks/HtmlPageLinkRendererEndHookHandlerTest.php b/repo/tests/phpunit/includes/Hooks/HtmlPageLinkRendererEndHookHandlerTest.php index d7d061c7791..e821d192754 100644 --- a/repo/tests/phpunit/includes/Hooks/HtmlPageLinkRendererEndHookHandlerTest.php +++ b/repo/tests/phpunit/includes/Hooks/HtmlPageLinkRendererEndHookHandlerTest.php @@ -70,9 +70,9 @@ public function testDoHtmlPageLinkRendererBegin_invalidContext( LinkRenderer $li $this->assertEquals( [], $customAttribs ); } - public function overrideSpecialNewEntityLinkProvider(): iterable { + public static function overrideSpecialNewEntityLinkProvider(): iterable { $entityContentFactory = WikibaseRepo::getEntityContentFactory(); - $namespaceLookup = $this->getEntityNamespaceLookup(); + $namespaceLookup = self::getEntityNamespaceLookup(); foreach ( $entityContentFactory->getEntityTypes() as $entityType ) { $entityHandler = $entityContentFactory->getContentHandlerForType( $entityType ); @@ -113,8 +113,8 @@ public function testDoHtmlPageLinkRendererBegin_overrideSpecialNewEntityLink( $this->assertStringContainsString( $specialPageTitle->getFullText(), $html ); } - public function noOverrideSpecialNewEntityLinkProvider(): iterable { - $lookup = $this->getEntityNamespaceLookup(); + public static function noOverrideSpecialNewEntityLinkProvider(): iterable { + $lookup = self::getEntityNamespaceLookup(); $itemNs = $lookup->getEntityNamespace( 'item' ); $propertyNs = $lookup->getEntityNamespace( 'property' ); return [ diff --git a/repo/tests/phpunit/includes/Hooks/HtmlPageLinkRendererEndHookHandlerTestBase.php b/repo/tests/phpunit/includes/Hooks/HtmlPageLinkRendererEndHookHandlerTestBase.php index 32d05703514..722b005c541 100644 --- a/repo/tests/phpunit/includes/Hooks/HtmlPageLinkRendererEndHookHandlerTestBase.php +++ b/repo/tests/phpunit/includes/Hooks/HtmlPageLinkRendererEndHookHandlerTestBase.php @@ -68,11 +68,11 @@ protected function newTitle( string $id, bool $exists = true, int $namespace = N return $title; } - protected function newContext( string $title = 'Special:Recentchanges' ): RequestContext { + protected static function newContext( string $title = 'Special:Recentchanges' ): RequestContext { return RequestContext::newExtraneousContext( Title::newFromTextThrow( $title ) ); } - protected function getLinkRenderer(): LinkRenderer { + protected static function getLinkRenderer(): LinkRenderer { $linkRenderer = MediaWikiServices::getInstance() ->getLinkRendererFactory()->create( [ 'renderForComment' => true ] ); return $linkRenderer; @@ -219,7 +219,7 @@ private function getTermLookup() { return $termLookup; } - final protected function getEntityNamespaceLookup() { + final protected static function getEntityNamespaceLookup() { $entityNamespaces = [ 'item' => 0, 'property' => 122, @@ -240,19 +240,19 @@ private function getInterwikiLookup() { return $lookup; } - public function validLinkRendererAndContextProvider() { - $commentLinkRenderer = $this->getLinkRenderer(); + public static function validLinkRendererAndContextProvider() { + $commentLinkRenderer = self::getLinkRenderer(); $nonCommentLinkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); - $specialPageContext = $this->newContext(); + $specialPageContext = self::newContext(); - $historyContext = $this->newContext( 'Foo' ); + $historyContext = self::newContext( 'Foo' ); $historyContext->getRequest()->setVal( 'action', 'history' ); - $diffContext = $this->newContext( 'Foo' ); + $diffContext = self::newContext( 'Foo' ); $diffContext->getRequest()->setVal( 'diff', 123 ); - $viewContext = $this->newContext( 'Foo' ); + $viewContext = self::newContext( 'Foo' ); return [ 'normal link, special page' => [ $nonCommentLinkRenderer, $specialPageContext ], @@ -263,15 +263,15 @@ public function validLinkRendererAndContextProvider() { ]; } - public function invalidLinkRendererAndContextProvider() { + public static function invalidLinkRendererAndContextProvider() { $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); - $viewContext = $this->newContext( 'Foo' ); + $viewContext = self::newContext( 'Foo' ); - $diffContext = $this->newContext( 'Foo' ); + $diffContext = self::newContext( 'Foo' ); $diffContext->getRequest()->setVal( 'diff', 123 ); - $specialBadTitleContext = $this->newContext( 'Special:Badtitle' ); + $specialBadTitleContext = self::newContext( 'Special:Badtitle' ); return [ 'normal link, normal view' => [ $linkRenderer, $viewContext ], diff --git a/repo/tests/phpunit/includes/Hooks/ShowSearchHitHandlerTest.php b/repo/tests/phpunit/includes/Hooks/ShowSearchHitHandlerTest.php index 1d661080535..a1a6650b942 100644 --- a/repo/tests/phpunit/includes/Hooks/ShowSearchHitHandlerTest.php +++ b/repo/tests/phpunit/includes/Hooks/ShowSearchHitHandlerTest.php @@ -210,7 +210,7 @@ private function getEntityContentFactory() { return $entityContentFactory; } - public function getPlainSearches() { + public static function getPlainSearches() { return [ "simple" => [ 'Q1', diff --git a/repo/tests/phpunit/includes/ParserOutput/EntityParserOutputGeneratorTestBase.php b/repo/tests/phpunit/includes/ParserOutput/EntityParserOutputGeneratorTestBase.php index 60a3cb1cdc6..e22c6b793e1 100644 --- a/repo/tests/phpunit/includes/ParserOutput/EntityParserOutputGeneratorTestBase.php +++ b/repo/tests/phpunit/includes/ParserOutput/EntityParserOutputGeneratorTestBase.php @@ -67,7 +67,7 @@ protected function newLanguageFallbackChain() { return $fallbackChain; } - protected function newItem() { + protected static function newItem() { $item = new Item( new ItemId( 'Q7799929' ) ); $item->setLabel( 'en', 'kitten item' ); diff --git a/repo/tests/phpunit/includes/ParserOutput/ExternalLinksDataUpdaterTest.php b/repo/tests/phpunit/includes/ParserOutput/ExternalLinksDataUpdaterTest.php index 743c0328902..dd75c7e9ecb 100644 --- a/repo/tests/phpunit/includes/ParserOutput/ExternalLinksDataUpdaterTest.php +++ b/repo/tests/phpunit/includes/ParserOutput/ExternalLinksDataUpdaterTest.php @@ -38,7 +38,7 @@ private function newInstance() { * @param string $string * @param int $propertyId */ - private function addStatement( StatementList $statements, $string, $propertyId = 1 ) { + private static function addStatement( StatementList $statements, $string, $propertyId = 1 ) { $statements->addNewStatement( new PropertyValueSnak( $propertyId, new StringValue( $string ) ) ); @@ -67,15 +67,15 @@ public function testUpdateParserOutput( StatementList $statements, array $expect $this->assertSame( $expected, $actual ); } - public function externalLinksProvider() { + public static function externalLinksProvider() { $set1 = new StatementList(); - $this->addStatement( $set1, 'http://1.de' ); - $this->addStatement( $set1, '' ); - $this->addStatement( $set1, 'no url property', 2 ); + self::addStatement( $set1, 'http://1.de' ); + self::addStatement( $set1, '' ); + self::addStatement( $set1, 'no url property', 2 ); $set2 = new StatementList(); - $this->addStatement( $set2, 'http://2a.de' ); - $this->addStatement( $set2, 'http://2b.de' ); + self::addStatement( $set2, 'http://2a.de' ); + self::addStatement( $set2, 'http://2b.de' ); return [ [ new StatementList(), [] ], diff --git a/repo/tests/phpunit/includes/ParserOutput/FullEntityParserOutputGeneratorTest.php b/repo/tests/phpunit/includes/ParserOutput/FullEntityParserOutputGeneratorTest.php index fe47741f109..941102ba02f 100644 --- a/repo/tests/phpunit/includes/ParserOutput/FullEntityParserOutputGeneratorTest.php +++ b/repo/tests/phpunit/includes/ParserOutput/FullEntityParserOutputGeneratorTest.php @@ -39,10 +39,10 @@ protected function setUp(): void { $this->entityViewFactory = $this->mockEntityViewFactory( false ); } - public function provideTestGetParserOutput() { + public static function provideTestGetParserOutput() { return [ [ - $this->newItem(), + self::newItem(), 'kitten item', [ 'http://an.url.com', 'https://another.url.org' ], [ 'File:This_is_a_file.pdf', 'File:Selfie.jpg' ], diff --git a/repo/tests/phpunit/includes/ParserOutput/GeoDataDataUpdaterTest.php b/repo/tests/phpunit/includes/ParserOutput/GeoDataDataUpdaterTest.php index e23c6a2c371..e1389fb9787 100644 --- a/repo/tests/phpunit/includes/ParserOutput/GeoDataDataUpdaterTest.php +++ b/repo/tests/phpunit/includes/ParserOutput/GeoDataDataUpdaterTest.php @@ -34,7 +34,7 @@ */ class GeoDataDataUpdaterTest extends MediaWikiIntegrationTestCase { - private function willSkipTests() { + private static function willSkipTests() { return !ExtensionRegistry::getInstance()->isLoaded( 'GeoData' ); } @@ -63,13 +63,13 @@ public function testProcessStatement( array $expected, array $statements, $messa $this->assertEquals( $expected, $updater->coordinates, $message ); } - public function processStatementProvider() { - if ( $this->willSkipTests() ) { + public static function processStatementProvider() { + if ( self::willSkipTests() ) { return [ [ [], [], 'dummy test will be skipped' ] ]; } - $statements = $this->getStatements(); - $coords = $this->getCoords(); + $statements = self::getStatements(); + $coords = self::getCoords(); return [ [ @@ -267,90 +267,90 @@ private function newGeoDataDataUpdater( array $preferredProperties ) { ); } - private function getStatements() { + private static function getStatements() { $statements = []; - $statements['P42-string'] = $this->newStatement( + $statements['P42-string'] = self::newStatement( new NumericPropertyId( 'P42' ), new StringValue( 'kittens!' ) ); - $statements['P625-geo'] = $this->newStatement( + $statements['P625-geo'] = self::newStatement( new NumericPropertyId( 'P625' ), - $this->newGlobeCoordinateValue( 19.7, 306.8, 'Q111' ) + self::newGlobeCoordinateValue( 19.7, 306.8, 'Q111' ) ); - $statements['P10-geo-A'] = $this->newStatement( + $statements['P10-geo-A'] = self::newStatement( new NumericPropertyId( 'P10' ), - $this->newGlobeCoordinateValue( 40.748433, -73.985655 ) + self::newGlobeCoordinateValue( 40.748433, -73.985655 ) ); - $statements['P10-geo-B'] = $this->newStatement( + $statements['P10-geo-B'] = self::newStatement( new NumericPropertyId( 'P10' ), - $this->newGlobeCoordinateValue( 44.264464, 52.643666 ) + self::newGlobeCoordinateValue( 44.264464, 52.643666 ) ); - $statements['P10-geo-preferred-A'] = $this->newStatementWithRank( + $statements['P10-geo-preferred-A'] = self::newStatementWithRank( new NumericPropertyId( 'P10' ), - $this->newGlobeCoordinateValue( 50.02440, 41.50202 ), + self::newGlobeCoordinateValue( 50.02440, 41.50202 ), Statement::RANK_PREFERRED ); - $statements['P10-geo-preferred-B'] = $this->newStatementWithRank( + $statements['P10-geo-preferred-B'] = self::newStatementWithRank( new NumericPropertyId( 'P10' ), - $this->newGlobeCoordinateValue( 70.0144, 30.0015 ), + self::newGlobeCoordinateValue( 70.0144, 30.0015 ), Statement::RANK_PREFERRED ); - $statements['P9000-geo-A'] = $this->newStatement( + $statements['P9000-geo-A'] = self::newStatement( new NumericPropertyId( 'P9000' ), - $this->newGlobeCoordinateValue( 33.643664, 20.464222 ) + self::newGlobeCoordinateValue( 33.643664, 20.464222 ) ); - $statements['P9000-geo-B'] = $this->newStatementWithQualifier( + $statements['P9000-geo-B'] = self::newStatementWithQualifier( new NumericPropertyId( 'P9000' ), - $this->newGlobeCoordinateValue( 11.1234, 12.5678 ), + self::newGlobeCoordinateValue( 11.1234, 12.5678 ), new SnakList( [ new PropertyValueSnak( new NumericPropertyId( 'P625' ), - $this->newGlobeCoordinateValue( 30.0987, 20.1234 ) + self::newGlobeCoordinateValue( 30.0987, 20.1234 ) ), ] ) ); - $statements['P9000-geo-preferred'] = $this->newStatementWithRank( + $statements['P9000-geo-preferred'] = self::newStatementWithRank( new NumericPropertyId( 'P9000' ), - $this->newGlobeCoordinateValue( 77.7777, 33.3333 ), + self::newGlobeCoordinateValue( 77.7777, 33.3333 ), Statement::RANK_PREFERRED ); - $statements['P17-geo-deprecated'] = $this->newStatementWithRank( + $statements['P17-geo-deprecated'] = self::newStatementWithRank( new NumericPropertyId( 'P17' ), - $this->newGlobeCoordinateValue( 10.0234, 11.52352 ), + self::newGlobeCoordinateValue( 10.0234, 11.52352 ), Statement::RANK_DEPRECATED ); - $statements['P20-some-value'] = $this->newStatement( new NumericPropertyId( 'P20' ) ); + $statements['P20-some-value'] = self::newStatement( new NumericPropertyId( 'P20' ) ); - $statements['P10-mismatch'] = $this->newStatement( + $statements['P10-mismatch'] = self::newStatement( new NumericPropertyId( 'P10' ), new StringValue( 'omg! wrong value type' ) ); - $statements['P404-unknown-property'] = $this->newStatement( + $statements['P404-unknown-property'] = self::newStatement( new NumericPropertyId( 'P404' ), - $this->newGlobeCoordinateValue( 40.733643, -72.352153 ) + self::newGlobeCoordinateValue( 40.733643, -72.352153 ) ); - $statements['P9002-unknown-globe'] = $this->newStatement( + $statements['P9002-unknown-globe'] = self::newStatement( new NumericPropertyId( 'P9002' ), - $this->newGlobeCoordinateValue( 9.017, 14.0987, 'Q147' ) + self::newGlobeCoordinateValue( 9.017, 14.0987, 'Q147' ) ); return $statements; } - private function getCoords() { + private static function getCoords() { return [ 'P625-geo' => new Coord( 19.7, 306.8, 'mars' ), 'P10-geo-A' => new Coord( 40.748433, -73.985655 ), @@ -363,7 +363,7 @@ private function getCoords() { ]; } - private function newStatement( NumericPropertyId $propertyId, DataValue $dataValue = null ) { + private static function newStatement( NumericPropertyId $propertyId, DataValue $dataValue = null ) { $guidGenerator = new GuidGenerator(); if ( $dataValue === null ) { @@ -377,29 +377,29 @@ private function newStatement( NumericPropertyId $propertyId, DataValue $dataVal return new Statement( $snak, null, null, $guid ); } - private function newStatementWithRank( + private static function newStatementWithRank( NumericPropertyId $propertyId, DataValue $dataValue, $rank ) { - $rankedStatement = $this->newStatement( $propertyId, $dataValue ); + $rankedStatement = self::newStatement( $propertyId, $dataValue ); $rankedStatement->setRank( $rank ); return $rankedStatement; } - private function newStatementWithQualifier( + private static function newStatementWithQualifier( NumericPropertyId $propertyId, DataValue $dataValue, SnakList $qualifiers ) { - $statement = $this->newStatement( $propertyId, $dataValue ); + $statement = self::newStatement( $propertyId, $dataValue ); $statement->setQualifiers( $qualifiers ); return $statement; } - private function newGlobeCoordinateValue( $lat, $lon, $globeId = 'Q2' ) { + private static function newGlobeCoordinateValue( $lat, $lon, $globeId = 'Q2' ) { $latLongValue = new LatLongValue( $lat, $lon ); // default globe is 'Q2' (earth) diff --git a/repo/tests/phpunit/includes/ParserOutput/ImageLinksDataUpdaterTest.php b/repo/tests/phpunit/includes/ParserOutput/ImageLinksDataUpdaterTest.php index 5035187838e..8c4cff1b2e7 100644 --- a/repo/tests/phpunit/includes/ParserOutput/ImageLinksDataUpdaterTest.php +++ b/repo/tests/phpunit/includes/ParserOutput/ImageLinksDataUpdaterTest.php @@ -55,7 +55,7 @@ private function newInstance() { * @param string $string * @param int $propertyId */ - private function addStatement( StatementList $statements, $string, $propertyId = 1 ) { + private static function addStatement( StatementList $statements, $string, $propertyId = 1 ) { $statements->addNewStatement( new PropertyValueSnak( $propertyId, new StringValue( $string ) ) ); @@ -81,19 +81,19 @@ public function testUpdateParserOutput( $this->assertSame( $expectedFileSearchOptions, $parserOutput->getFileSearchOptions() ); } - public function imageLinksProvider() { + public static function imageLinksProvider() { $set1 = new StatementList(); - $this->addStatement( $set1, '1.jpg' ); - $this->addStatement( $set1, '' ); - $this->addStatement( $set1, 'no image property', 2 ); + self::addStatement( $set1, '1.jpg' ); + self::addStatement( $set1, '' ); + self::addStatement( $set1, 'no image property', 2 ); $set2 = new StatementList(); - $this->addStatement( $set2, '2a.jpg' ); - $this->addStatement( $set2, '2b.jpg' ); + self::addStatement( $set2, '2a.jpg' ); + self::addStatement( $set2, '2b.jpg' ); $set3 = new StatementList(); - $this->addStatement( $set3, '2a.jpg' ); - $this->addStatement( $set3, 'Exists.png' ); + self::addStatement( $set3, '2a.jpg' ); + self::addStatement( $set3, 'Exists.png' ); return [ [ new StatementList(), [], [] ], diff --git a/repo/tests/phpunit/includes/ParserOutput/PageImagesDataUpdaterTest.php b/repo/tests/phpunit/includes/ParserOutput/PageImagesDataUpdaterTest.php index 809585a988f..b4f000e398a 100644 --- a/repo/tests/phpunit/includes/ParserOutput/PageImagesDataUpdaterTest.php +++ b/repo/tests/phpunit/includes/ParserOutput/PageImagesDataUpdaterTest.php @@ -37,7 +37,7 @@ private function newInstance( array $propertyIds ) { * @param string $string * @param int $rank */ - private function addStatement( + private static function addStatement( StatementList $statements, $propertyId, $string, @@ -95,30 +95,30 @@ public function testUpdateParserOutput( $instance->updateParserOutput( $parserOutput ); } - public function bestImageProvider() { + public static function bestImageProvider() { $statements = new StatementList(); - $this->addStatement( $statements, 1, '1.jpg' ); + self::addStatement( $statements, 1, '1.jpg' ); $statements->addNewStatement( new PropertyNoValueSnak( 2 ) ); $statements->addNewStatement( new PropertySomeValueSnak( 2 ) ); $statements->addNewStatement( new PropertyValueSnak( 2, new BooleanValue( true ) ) ); - $this->addStatement( $statements, 2, '' ); - $this->addStatement( $statements, 2, '2.jpg', Statement::RANK_DEPRECATED ); + self::addStatement( $statements, 2, '' ); + self::addStatement( $statements, 2, '2.jpg', Statement::RANK_DEPRECATED ); $statements->addNewStatement( new PropertySomeValueSnak( 3 ) ); - $this->addStatement( $statements, 3, '3a.jpg' ); - $this->addStatement( $statements, 3, '3b.jpg' ); - - $this->addStatement( $statements, 4, 'Four 1.jpg', Statement::RANK_DEPRECATED ); - $this->addStatement( $statements, 4, 'Four 2.jpg' ); - $this->addStatement( $statements, 4, 'Four 3.jpg' ); - - $this->addStatement( $statements, 5, '5a.jpg' ); - $this->addStatement( $statements, 4, '5b.jpg', Statement::RANK_DEPRECATED ); - $this->addStatement( $statements, 5, '5c.jpg', Statement::RANK_PREFERRED ); - $this->addStatement( $statements, 5, '5d.jpg' ); - $this->addStatement( $statements, 5, '5e.jpg', Statement::RANK_PREFERRED ); + self::addStatement( $statements, 3, '3a.jpg' ); + self::addStatement( $statements, 3, '3b.jpg' ); + + self::addStatement( $statements, 4, 'Four 1.jpg', Statement::RANK_DEPRECATED ); + self::addStatement( $statements, 4, 'Four 2.jpg' ); + self::addStatement( $statements, 4, 'Four 3.jpg' ); + + self::addStatement( $statements, 5, '5a.jpg' ); + self::addStatement( $statements, 4, '5b.jpg', Statement::RANK_DEPRECATED ); + self::addStatement( $statements, 5, '5c.jpg', Statement::RANK_PREFERRED ); + self::addStatement( $statements, 5, '5d.jpg' ); + self::addStatement( $statements, 5, '5e.jpg', Statement::RANK_PREFERRED ); return [ // Find nothing for various reasons. diff --git a/repo/tests/phpunit/includes/Parsers/MwDateFormatParserFactoryTest.php b/repo/tests/phpunit/includes/Parsers/MwDateFormatParserFactoryTest.php index f72b17fd568..0c48bb9b66c 100644 --- a/repo/tests/phpunit/includes/Parsers/MwDateFormatParserFactoryTest.php +++ b/repo/tests/phpunit/includes/Parsers/MwDateFormatParserFactoryTest.php @@ -79,7 +79,7 @@ public function testParseWithValidInputs( "'$input' in $languageCode became $parsed instead of $expected" ); } - public function validInputProvider() { + public static function validInputProvider() { $dateFormatPreferences = [ 'mdy' => TimeValue::PRECISION_MINUTE, 'dmy' => TimeValue::PRECISION_MINUTE, @@ -93,12 +93,12 @@ public function validInputProvider() { ]; $languageFactory = MediaWikiServices::getInstance()->getLanguageFactory(); - foreach ( $this->getLanguageCodes() as $languageCode ) { + foreach ( self::getLanguageCodes() as $languageCode ) { $language = $languageFactory->getLanguage( $languageCode ); foreach ( $dateFormatPreferences as $dateFormatPreference => $maximumPrecision ) { foreach ( $dateFormatTypes as $dateFormatType => $precision ) { - $mwTimestamp = $this->generateMwTimestamp(); + $mwTimestamp = self::generateMwTimestamp(); $dateFormat = $language->getDateFormatString( $dateFormatType, $dateFormatPreference ); $input = $language->sprintfDate( $dateFormat, $mwTimestamp ); @@ -110,7 +110,7 @@ public function validInputProvider() { ? TimeValue::CALENDAR_JULIAN : TimeValue::CALENDAR_GREGORIAN; $expected = new TimeValue( - $this->getIsoTimestamp( $mwTimestamp, $precision ), + self::getIsoTimestamp( $mwTimestamp, $precision ), 0, 0, 0, $precision, $calendarModel @@ -128,7 +128,7 @@ public function validInputProvider() { } } - private function getLanguageCodes() { + private static function getLanguageCodes() { // Focus on a critical subset of languages. Enable the following MediaWiki dependency to // test the full set of all 400+ supported languages. This may take several minutes. // return array_keys( MediaWikiServices::getInstance()->getLanguageNameUtils()->getLanguageNames() ); @@ -160,7 +160,7 @@ private function getLanguageCodes() { /** * @return string */ - private function generateMwTimestamp() { + private static function generateMwTimestamp() { static $mwTimestamps; if ( $mwTimestamps === null ) { @@ -190,7 +190,7 @@ private function generateMwTimestamp() { * * @return string */ - private function getIsoTimestamp( $mwTimestamp, $precision ) { + private static function getIsoTimestamp( $mwTimestamp, $precision ) { if ( $precision <= TimeValue::PRECISION_YEAR ) { $mwTimestamp = substr( $mwTimestamp, 0, 4 ) . '0000000000'; } elseif ( $precision === TimeValue::PRECISION_MONTH ) { diff --git a/repo/tests/phpunit/includes/Parsers/TimeFormatterParserRoundtripTest.php b/repo/tests/phpunit/includes/Parsers/TimeFormatterParserRoundtripTest.php index a005d90015f..78bab18f780 100644 --- a/repo/tests/phpunit/includes/Parsers/TimeFormatterParserRoundtripTest.php +++ b/repo/tests/phpunit/includes/Parsers/TimeFormatterParserRoundtripTest.php @@ -62,10 +62,10 @@ public static function isoTimestampProvider() { ]; } - public function timeValueProvider() { + public static function timeValueProvider() { $gregorian = 'http://www.wikidata.org/entity/Q1985727'; - foreach ( $this->isoTimestampProvider() as $case ) { + foreach ( self::isoTimestampProvider() as $case ) { yield [ new TimeValue( $case[0], 0, 0, 0, $case[1], $gregorian ) ]; } } diff --git a/repo/tests/phpunit/includes/Rdf/DateTimeValueCleanerTest.php b/repo/tests/phpunit/includes/Rdf/DateTimeValueCleanerTest.php index 79323d4e768..7879078244c 100644 --- a/repo/tests/phpunit/includes/Rdf/DateTimeValueCleanerTest.php +++ b/repo/tests/phpunit/includes/Rdf/DateTimeValueCleanerTest.php @@ -41,7 +41,7 @@ public static function illegalTimeValueProvider() { ]; } - public function getDates() { + public static function getDates() { $greg = TimeValue::CALENDAR_GREGORIAN; $jul = TimeValue::CALENDAR_JULIAN; $year1m = TimeValue::PRECISION_YEAR1M; @@ -93,7 +93,7 @@ public function getDates() { ]; } - public function getDatesXSD11() { + public static function getDatesXSD11() { $greg = TimeValue::CALENDAR_GREGORIAN; $jul = TimeValue::CALENDAR_JULIAN; $year10 = TimeValue::PRECISION_YEAR10; diff --git a/repo/tests/phpunit/includes/Rdf/FullStatementRdfBuilderTest.php b/repo/tests/phpunit/includes/Rdf/FullStatementRdfBuilderTest.php index 3112bd305f0..34c30d7adbf 100644 --- a/repo/tests/phpunit/includes/Rdf/FullStatementRdfBuilderTest.php +++ b/repo/tests/phpunit/includes/Rdf/FullStatementRdfBuilderTest.php @@ -122,7 +122,7 @@ private function assertTriples( $dataSetNames, RdfWriter $writer ) { $this->helper->assertNTriplesEqualsDataset( $dataSetNames, $actual ); } - public function provideAddEntity() { + public static function provideAddEntity() { $props = array_map( function ( $data ) { /** @var PropertyId $propertyId */ @@ -172,7 +172,7 @@ public function testAddEntity( $entityName, $flavor, $dataSetNames, array $expec $this->assertEquals( $expectedMentions, array_keys( $mentioned ), 'Entities mentioned' ); } - public function provideAddEntityTestCasesWhenPropertiesFromOtherWikibase() { + public static function provideAddEntityTestCasesWhenPropertiesFromOtherWikibase() { $props = array_map( function ( $data ) { /** @var PropertyId $propertyId */ diff --git a/repo/tests/phpunit/includes/Rdf/PropertyRdfBuilderTest.php b/repo/tests/phpunit/includes/Rdf/PropertyRdfBuilderTest.php index b78a6d18c86..98d35a4d3ba 100644 --- a/repo/tests/phpunit/includes/Rdf/PropertyRdfBuilderTest.php +++ b/repo/tests/phpunit/includes/Rdf/PropertyRdfBuilderTest.php @@ -73,12 +73,12 @@ public function testInternalRdfBuildersCallsAddEntity_dependingOnFlavorFlags( $builder->addEntity( $property ); } - public function provideAddEntity(): array { + public static function provideAddEntity(): array { return [ - "No flavors selected" => [ 0, $this->getTestProperty() ], - "Just truthy statements requested" => [ RdfProducer::PRODUCE_TRUTHY_STATEMENTS, $this->getTestProperty(), true ], - "Full statements requested" => [ RdfProducer::PRODUCE_ALL_STATEMENTS, $this->getTestProperty(), false, true ], - "All statements requested" => [ RdfProducer::PRODUCE_ALL, $this->getTestProperty(), true, true ], + "No flavors selected" => [ 0, self::getTestProperty() ], + "Just truthy statements requested" => [ RdfProducer::PRODUCE_TRUTHY_STATEMENTS, self::getTestProperty(), true ], + "Full statements requested" => [ RdfProducer::PRODUCE_ALL_STATEMENTS, self::getTestProperty(), false, true ], + "All statements requested" => [ RdfProducer::PRODUCE_ALL, self::getTestProperty(), true, true ], ]; } @@ -92,7 +92,7 @@ private function getBuilder( $flavorFlags ): PropertyRdfBuilder { ); } - private function getTestProperty(): Property { + private static function getTestProperty(): Property { return new Property( null, null, 'footype' ); diff --git a/repo/tests/phpunit/includes/Rdf/RdfBuilderTest.php b/repo/tests/phpunit/includes/Rdf/RdfBuilderTest.php index bd38a54e57c..521e642b5c1 100644 --- a/repo/tests/phpunit/includes/Rdf/RdfBuilderTest.php +++ b/repo/tests/phpunit/includes/Rdf/RdfBuilderTest.php @@ -461,7 +461,7 @@ public function testAddEntityRedirect(): void { $this->helper->assertNTriplesEquals( $expected, $builder->getRDF() ); } - public function getProduceOptions(): iterable { + public static function getProduceOptions(): iterable { return [ [ 'Q4', @@ -586,7 +586,7 @@ public function testDeduplication_whenPropertiesFromOtherWikibase(): void { $this->helper->assertNTriplesEqualsDataset( 'Q7_Q9_dedup_foreignsource_properties', $data1 . $data2 ); } - public function getProps(): iterable { + public static function getProps(): iterable { return [ 'simple prop' => [ 'prop1', diff --git a/repo/tests/phpunit/includes/Rdf/ValueSnakRdfBuilderFactoryTest.php b/repo/tests/phpunit/includes/Rdf/ValueSnakRdfBuilderFactoryTest.php index 050466dd854..5bf24357197 100644 --- a/repo/tests/phpunit/includes/Rdf/ValueSnakRdfBuilderFactoryTest.php +++ b/repo/tests/phpunit/includes/Rdf/ValueSnakRdfBuilderFactoryTest.php @@ -27,7 +27,7 @@ */ class ValueSnakRdfBuilderFactoryTest extends \PHPUnit\Framework\TestCase { - public function getBuilderFlags() { + public static function getBuilderFlags() { return [ [ 0 ], // simple values [ RdfProducer::PRODUCE_FULL_VALUES ], // complex values