@@ -23,6 +23,9 @@ |
||
23 | 23 | $this->setWbSetting( 'federatedPropertiesEnabled', true ); |
24 | 24 | } |
25 | 25 | |
26 | + /** |
|
27 | + * @param string|boolean $value |
|
28 | + */ |
|
26 | 29 | private function setWbSetting( string $name, $value ) { |
27 | 30 | $this->setWbSettingInGlobalIfMwIntegrationTest( $name, $value ); |
28 | 31 | $this->setWbSettingInSettings( $name, $value ); |
@@ -21,6 +21,7 @@ |
||
21 | 21 | * @param LabelsProvider $entity |
22 | 22 | * @param string $msg Message key (string) for error text |
23 | 23 | * @param array $params Array with parameters to wfMessage() |
24 | + * @param string|null $languageCode |
|
24 | 25 | * |
25 | 26 | * @suppress SecurityCheck-DoubleEscaped |
26 | 27 | */ |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @param IResultWrapper|array $rows |
37 | - * @param array $languageCodes |
|
37 | + * @param string[] $languageCodes |
|
38 | 38 | * @param array $termTypes |
39 | 39 | */ |
40 | 40 | public function prefetchFederatedProperties( $rows, array $languageCodes, array $termTypes ) : void { |
@@ -182,6 +182,9 @@ |
||
182 | 182 | return $rows; |
183 | 183 | } |
184 | 184 | |
185 | + /** |
|
186 | + * @param string $titleText |
|
187 | + */ |
|
185 | 188 | private function getMockedDiffEngine( $getOldRevision, $getNewRevision, $titleText ) { |
186 | 189 | $diffEngine = $this->createMock( DifferenceEngine::class ); |
187 | 190 | $diffEngine->expects( $this->once() ) |
@@ -55,7 +55,6 @@ discard block |
||
55 | 55 | * @param string[] $termTypes |
56 | 56 | * @param string[] $languageCodes |
57 | 57 | * @param PrefetchingTermLookup|null $prefetchingTermLookup |
58 | - * @param EntityLookup|null $entityLookup |
|
59 | 58 | * @param bool $federatedPropertiesEnabled |
60 | 59 | * @return LabelPrefetchHookHandler |
61 | 60 | */ |
@@ -103,6 +102,10 @@ discard block |
||
103 | 102 | ); |
104 | 103 | } |
105 | 104 | |
105 | + /** |
|
106 | + * @param string[] $expectedTermTypes |
|
107 | + * @param string[] $expectedLanguageCodes |
|
108 | + */ |
|
106 | 109 | protected function getPrefetchTermsCallback( $expectedIds, $expectedTermTypes, $expectedLanguageCodes ) { |
107 | 110 | $prefetchTerms = function ( |
108 | 111 | array $entityIds, |
@@ -155,6 +155,9 @@ discard block |
||
155 | 155 | ]; |
156 | 156 | } |
157 | 157 | |
158 | + /** |
|
159 | + * @param PropertyId[] $expectedIds |
|
160 | + */ |
|
158 | 161 | protected function getPrefetchTermsCallback( $expectedIds ) { |
159 | 162 | $prefetchTerms = function ( |
160 | 163 | array $entityIds, |
@@ -178,6 +181,9 @@ discard block |
||
178 | 181 | return $prefetchTerms; |
179 | 182 | } |
180 | 183 | |
184 | + /** |
|
185 | + * @param FullEntityParserOutputGenerator $fullGenerator |
|
186 | + */ |
|
181 | 187 | private function newEntityParserOutputGenerator( $prefetchingTermLookup, $fullGenerator, $languageCode = 'en' ) { |
182 | 188 | return new FederatedPropertiesEntityParserOutputGenerator( |
183 | 189 | $fullGenerator, |
@@ -1071,6 +1071,10 @@ discard block |
||
1071 | 1071 | $this->invokeMethodIfNoRequiredParameters( $wbRepo, $reflectionClass->getMethod( $methodName ) ); |
1072 | 1072 | } |
1073 | 1073 | |
1074 | + /** |
|
1075 | + * @param WikibaseRepo $wbRepo |
|
1076 | + * @param ReflectionMethod $method |
|
1077 | + */ |
|
1074 | 1078 | private function invokeMethodIfNoRequiredParameters( $wbRepo, $method ) { |
1075 | 1079 | if ( $method->getNumberOfRequiredParameters() === 0 ) { |
1076 | 1080 | $method->invoke( $wbRepo ); |
@@ -1086,6 +1090,10 @@ discard block |
||
1086 | 1090 | ); |
1087 | 1091 | } |
1088 | 1092 | |
1093 | + /** |
|
1094 | + * @param string $settingName |
|
1095 | + * @param boolean $settingValue |
|
1096 | + */ |
|
1089 | 1097 | private function getSettingsCopyWithSettingSet( $settingName, $settingValue ) { |
1090 | 1098 | $settings = new SettingsArray( WikibaseRepo::getDefaultInstance()->getSettings()->getArrayCopy() ); |
1091 | 1099 | $settings->setSetting( $settingName, $settingValue ); |
@@ -342,6 +342,9 @@ |
||
342 | 342 | ); |
343 | 343 | } |
344 | 344 | |
345 | + /** |
|
346 | + * @return PrefetchingTermLookup |
|
347 | + */ |
|
345 | 348 | public function getPrefetchingTermLookup() { |
346 | 349 | if ( $this->prefetchingTermLookup === null ) { |
347 | 350 | $this->prefetchingTermLookup = new ByTypeDispatchingPrefetchingTermLookup( |
@@ -56,6 +56,9 @@ discard block |
||
56 | 56 | return new ApiEntitySearchHelper( $api, $dataTypes ); |
57 | 57 | } |
58 | 58 | |
59 | + /** |
|
60 | + * @param string $responseDataFile |
|
61 | + */ |
|
59 | 62 | private function setupTestApi( &$params, $langCode, $responseDataFile, $statusCode = 200 ) { |
60 | 63 | $params = array_merge( $params, [ 'language' => $langCode, 'uselang' => $langCode, 'format' => 'json' ] ); |
61 | 64 | $api = $this->createMock( GenericActionApiClient::class ); |
@@ -152,8 +155,8 @@ discard block |
||
152 | 155 | /** |
153 | 156 | * @dataProvider paramsAndExpectedResponseProvider |
154 | 157 | * @param string $responseDataFile |
155 | - * @param int $expectedResultCount |
|
156 | - * @param array $expectedResultsEntityId |
|
158 | + * @param int $expectedResultsEntityIds |
|
159 | + * @param array $expectedResultsEntityIds |
|
157 | 160 | * @throws ApiRequestException |
158 | 161 | */ |
159 | 162 | public function testGetRankedSearchResults( $langCode, $params, $responseDataFile, $expectedResultsEntityIds ) { |
@@ -220,6 +223,9 @@ discard block |
||
220 | 223 | } |
221 | 224 | } |
222 | 225 | |
226 | + /** |
|
227 | + * @return string |
|
228 | + */ |
|
223 | 229 | private function getResponseDataForId( array $searchResponses, $resultId ) { |
224 | 230 | $searchResponses = array_filter( $searchResponses, function ( $response ) use ( $resultId ) { |
225 | 231 | return $response->id === $resultId; |
@@ -233,8 +239,6 @@ discard block |
||
233 | 239 | /** |
234 | 240 | * @dataProvider invalidParamsAndUnexpectedResponseProvider |
235 | 241 | * @param string $responseDataFile |
236 | - * @param int $expectedResultCount |
|
237 | - * @param array $expectedResultsEntityId |
|
238 | 242 | */ |
239 | 243 | public function testApiResponseStructureIsValid( $langCode, $params, $responseDataFile, $statusCode ) { |
240 | 244 | $api = $this->setupTestApi( $params, $langCode, $responseDataFile, $statusCode ); |