3 use Wikimedia\TestingAccessWrapper
;
6 * Checks that all API modules, core and extensions, conform to the conventions:
7 * - have documentation i18n messages (the test won't catch everything since
8 * i18n messages can vary based on the wiki configuration, but it should
9 * catch many cases for forgotten i18n)
10 * - do not have inconsistencies in the parameter definitions
15 class ApiStructureTest
extends MediaWikiTestCase
{
20 /** @var array Sets of globals to test. Each array element is input to HashConfig */
21 private static $testGlobals = [
31 * Values are an array, where each array value is a permitted type. A type
32 * can be a string, which is the name of an internal type or a
33 * class/interface. Or it can be an array, in which case the value must be
34 * an array whose elements are the types given in the array (e.g., [
35 * 'string', integer' ] means an array whose entries are strings and/or
38 private static $paramTypes = [
39 // ApiBase::PARAM_DFLT => as appropriate for PARAM_TYPE
40 ApiBase
::PARAM_ISMULTI
=> [ 'boolean' ],
41 ApiBase
::PARAM_TYPE
=> [ 'string', [ 'string' ] ],
42 ApiBase
::PARAM_MAX
=> [ 'integer' ],
43 ApiBase
::PARAM_MAX2
=> [ 'integer' ],
44 ApiBase
::PARAM_MIN
=> [ 'integer' ],
45 ApiBase
::PARAM_ALLOW_DUPLICATES
=> [ 'boolean' ],
46 ApiBase
::PARAM_DEPRECATED
=> [ 'boolean' ],
47 ApiBase
::PARAM_REQUIRED
=> [ 'boolean' ],
48 ApiBase
::PARAM_RANGE_ENFORCE
=> [ 'boolean' ],
49 ApiBase
::PARAM_HELP_MSG
=> [ 'string', 'array', Message
::class ],
50 ApiBase
::PARAM_HELP_MSG_APPEND
=> [ [ 'string', 'array', Message
::class ] ],
51 ApiBase
::PARAM_HELP_MSG_INFO
=> [ [ 'array' ] ],
52 ApiBase
::PARAM_VALUE_LINKS
=> [ [ 'string' ] ],
53 ApiBase
::PARAM_HELP_MSG_PER_VALUE
=> [ [ 'string', 'array', Message
::class ] ],
54 ApiBase
::PARAM_SUBMODULE_MAP
=> [ [ 'string' ] ],
55 ApiBase
::PARAM_SUBMODULE_PARAM_PREFIX
=> [ 'string' ],
56 ApiBase
::PARAM_ALL
=> [ 'boolean', 'string' ],
57 ApiBase
::PARAM_EXTRA_NAMESPACES
=> [ [ 'integer' ] ],
58 ApiBase
::PARAM_SENSITIVE
=> [ 'boolean' ],
59 ApiBase
::PARAM_DEPRECATED_VALUES
=> [ 'array' ],
60 ApiBase
::PARAM_ISMULTI_LIMIT1
=> [ 'integer' ],
61 ApiBase
::PARAM_ISMULTI_LIMIT2
=> [ 'integer' ],
62 ApiBase
::PARAM_MAX_BYTES
=> [ 'integer' ],
63 ApiBase
::PARAM_MAX_CHARS
=> [ 'integer' ],
64 ApiBase
::PARAM_TEMPLATE_VARS
=> [ 'array' ],
67 // param => [ other param that must be present => required value or null ]
68 private static $paramRequirements = [
69 ApiBase
::PARAM_ALLOW_DUPLICATES
=> [ ApiBase
::PARAM_ISMULTI
=> true ],
70 ApiBase
::PARAM_ALL
=> [ ApiBase
::PARAM_ISMULTI
=> true ],
71 ApiBase
::PARAM_ISMULTI_LIMIT1
=> [
72 ApiBase
::PARAM_ISMULTI
=> true,
73 ApiBase
::PARAM_ISMULTI_LIMIT2
=> null,
75 ApiBase
::PARAM_ISMULTI_LIMIT2
=> [
76 ApiBase
::PARAM_ISMULTI
=> true,
77 ApiBase
::PARAM_ISMULTI_LIMIT1
=> null,
81 // param => type(s) allowed for this param ('array' is any array)
82 private static $paramAllowedTypes = [
83 ApiBase
::PARAM_MAX
=> [ 'integer', 'limit' ],
84 ApiBase
::PARAM_MAX2
=> 'limit',
85 ApiBase
::PARAM_MIN
=> [ 'integer', 'limit' ],
86 ApiBase
::PARAM_RANGE_ENFORCE
=> 'integer',
87 ApiBase
::PARAM_VALUE_LINKS
=> 'array',
88 ApiBase
::PARAM_HELP_MSG_PER_VALUE
=> 'array',
89 ApiBase
::PARAM_SUBMODULE_MAP
=> 'submodule',
90 ApiBase
::PARAM_SUBMODULE_PARAM_PREFIX
=> 'submodule',
91 ApiBase
::PARAM_ALL
=> 'array',
92 ApiBase
::PARAM_EXTRA_NAMESPACES
=> 'namespace',
93 ApiBase
::PARAM_DEPRECATED_VALUES
=> 'array',
94 ApiBase
::PARAM_MAX_BYTES
=> [ 'NULL', 'string', 'text', 'password' ],
95 ApiBase
::PARAM_MAX_CHARS
=> [ 'NULL', 'string', 'text', 'password' ],
98 private static $paramProhibitedTypes = [
99 ApiBase
::PARAM_ISMULTI
=> [ 'boolean', 'limit', 'upload' ],
100 ApiBase
::PARAM_ALL
=> 'namespace',
101 ApiBase
::PARAM_SENSITIVE
=> 'password',
104 private static $constantNames = null;
107 * Initialize/fetch the ApiMain instance for testing
110 private static function getMain() {
111 if ( !self
::$main ) {
112 self
::$main = new ApiMain( RequestContext
::getMain() );
113 self
::$main->getContext()->setLanguage( 'en' );
114 self
::$main->getContext()->setTitle(
115 Title
::makeTitle( NS_SPECIAL
, 'Badtitle/dummy title for ApiStructureTest' )
123 * @param Message $msg
124 * @param string $what Which message is being checked
126 private function checkMessage( $msg, $what ) {
127 $msg = ApiBase
::makeMessage( $msg, self
::getMain()->getContext() );
128 $this->assertInstanceOf( Message
::class, $msg, "$what message" );
129 $this->assertTrue( $msg->exists(), "$what message {$msg->getKey()} exists" );
133 * @dataProvider provideDocumentationExists
134 * @param string $path Module path
135 * @param array $globals Globals to set
137 public function testDocumentationExists( $path, array $globals ) {
138 $main = self
::getMain();
140 // Set configuration variables
141 $main->getContext()->setConfig( new MultiConfig( [
142 new HashConfig( $globals ),
143 RequestContext
::getMain()->getConfig(),
145 foreach ( $globals as $k => $v ) {
146 $this->setMwGlobals( "wg$k", $v );
150 $module = TestingAccessWrapper
::newFromObject( $main->getModuleFromPath( $path ) );
152 // Test messages for flags.
153 foreach ( $module->getHelpFlags() as $flag ) {
154 $this->checkMessage( "api-help-flag-$flag", "Flag $flag" );
157 // Module description messages.
158 $this->checkMessage( $module->getSummaryMessage(), 'Module summary' );
159 $this->checkMessage( $module->getExtendedDescription(), 'Module help top text' );
161 // Parameters. Lots of messages in here.
162 $params = $module->getFinalParams( ApiBase
::GET_VALUES_FOR_HELP
);
164 foreach ( $params as $name => $settings ) {
165 if ( !is_array( $settings ) ) {
169 // Basic description message
170 if ( isset( $settings[ApiBase
::PARAM_HELP_MSG
] ) ) {
171 $msg = $settings[ApiBase
::PARAM_HELP_MSG
];
173 $msg = "apihelp-{$path}-param-{$name}";
175 $this->checkMessage( $msg, "Parameter $name description" );
177 // If param-per-value is in use, each value's message
178 if ( isset( $settings[ApiBase
::PARAM_HELP_MSG_PER_VALUE
] ) ) {
179 $this->assertInternalType( 'array', $settings[ApiBase
::PARAM_HELP_MSG_PER_VALUE
],
180 "Parameter $name PARAM_HELP_MSG_PER_VALUE is array" );
181 $this->assertInternalType( 'array', $settings[ApiBase
::PARAM_TYPE
],
182 "Parameter $name PARAM_TYPE is array for msg-per-value mode" );
183 $valueMsgs = $settings[ApiBase
::PARAM_HELP_MSG_PER_VALUE
];
184 foreach ( $settings[ApiBase
::PARAM_TYPE
] as $value ) {
185 if ( isset( $valueMsgs[$value] ) ) {
186 $msg = $valueMsgs[$value];
188 $msg = "apihelp-{$path}-paramvalue-{$name}-{$value}";
190 $this->checkMessage( $msg, "Parameter $name value $value" );
194 // Appended messages (e.g. "disabled in miser mode")
195 if ( isset( $settings[ApiBase
::PARAM_HELP_MSG_APPEND
] ) ) {
196 $this->assertInternalType( 'array', $settings[ApiBase
::PARAM_HELP_MSG_APPEND
],
197 "Parameter $name PARAM_HELP_MSG_APPEND is array" );
198 foreach ( $settings[ApiBase
::PARAM_HELP_MSG_APPEND
] as $i => $msg ) {
199 $this->checkMessage( $msg, "Parameter $name HELP_MSG_APPEND #$i" );
203 // Info tags (e.g. "only usable in mode 1") are typically shared by
204 // several parameters, so accumulate them and test them later.
205 if ( !empty( $settings[ApiBase
::PARAM_HELP_MSG_INFO
] ) ) {
206 foreach ( $settings[ApiBase
::PARAM_HELP_MSG_INFO
] as $i ) {
207 $tags[array_shift( $i )] = 1;
212 // Info tags (e.g. "only usable in mode 1") accumulated above
213 foreach ( $tags as $tag => $dummy ) {
214 $this->checkMessage( "apihelp-{$path}-paraminfo-{$tag}", "HELP_MSG_INFO tag $tag" );
217 // Messages for examples.
218 foreach ( $module->getExamplesMessages() as $qs => $msg ) {
219 $this->assertStringStartsNotWith( 'api.php?', $qs,
220 "Query string must not begin with 'api.php?'" );
221 $this->checkMessage( $msg, "Example $qs" );
225 public static function provideDocumentationExists() {
226 $main = self
::getMain();
227 $paths = self
::getSubModulePaths( $main->getModuleManager() );
228 array_unshift( $paths, $main->getModulePath() );
231 foreach ( $paths as $path ) {
232 foreach ( self
::$testGlobals as $globals ) {
234 foreach ( $globals as $k => $v ) {
235 $g[] = "$k=" . var_export( $v, 1 );
237 $k = "Module $path with " . implode( ', ', $g );
238 $ret[$k] = [ $path, $globals ];
245 * @dataProvider provideParameterConsistency
246 * @param string $path
248 public function testParameterConsistency( $path ) {
249 $main = self
::getMain();
250 $module = TestingAccessWrapper
::newFromObject( $main->getModuleFromPath( $path ) );
252 $paramsPlain = $module->getFinalParams();
253 $paramsForHelp = $module->getFinalParams( ApiBase
::GET_VALUES_FOR_HELP
);
255 // avoid warnings about empty tests when no parameter needs to be checked
256 $this->assertTrue( true );
258 if ( self
::$constantNames === null ) {
259 self
::$constantNames = [];
261 foreach ( ( new ReflectionClass( 'ApiBase' ) )->getConstants() as $key => $val ) {
262 if ( substr( $key, 0, 6 ) === 'PARAM_' ) {
263 self
::$constantNames[$val] = $key;
268 foreach ( [ $paramsPlain, $paramsForHelp ] as $params ) {
269 foreach ( $params as $param => $config ) {
270 if ( !is_array( $config ) ) {
271 $config = [ ApiBase
::PARAM_DFLT
=> $config ];
273 if ( !isset( $config[ApiBase
::PARAM_TYPE
] ) ) {
274 $config[ApiBase
::PARAM_TYPE
] = isset( $config[ApiBase
::PARAM_DFLT
] )
275 ?
gettype( $config[ApiBase
::PARAM_DFLT
] )
279 foreach ( self
::$paramTypes as $key => $types ) {
280 if ( !isset( $config[$key] ) ) {
283 $keyName = self
::$constantNames[$key];
284 $this->validateType( $types, $config[$key], $param, $keyName );
287 foreach ( self
::$paramRequirements as $key => $required ) {
288 if ( !isset( $config[$key] ) ) {
291 foreach ( $required as $requireKey => $requireVal ) {
292 $this->assertArrayHasKey( $requireKey, $config,
293 "$param: When " . self
::$constantNames[$key] . " is set, " .
294 self
::$constantNames[$requireKey] . " must also be set" );
295 if ( $requireVal !== null ) {
296 $this->assertSame( $requireVal, $config[$requireKey],
297 "$param: When " . self
::$constantNames[$key] . " is set, " .
298 self
::$constantNames[$requireKey] . " must equal " .
299 var_export( $requireVal, true ) );
304 foreach ( self
::$paramAllowedTypes as $key => $allowedTypes ) {
305 if ( !isset( $config[$key] ) ) {
309 $actualType = is_array( $config[ApiBase
::PARAM_TYPE
] )
310 ?
'array' : $config[ApiBase
::PARAM_TYPE
];
312 $this->assertContains(
314 (array)$allowedTypes,
315 "$param: " . self
::$constantNames[$key] .
316 " can only be used with PARAM_TYPE " .
317 implode( ', ', (array)$allowedTypes )
321 foreach ( self
::$paramProhibitedTypes as $key => $prohibitedTypes ) {
322 if ( !isset( $config[$key] ) ) {
326 $actualType = is_array( $config[ApiBase
::PARAM_TYPE
] )
327 ?
'array' : $config[ApiBase
::PARAM_TYPE
];
329 $this->assertNotContains(
331 (array)$prohibitedTypes,
332 "$param: " . self
::$constantNames[$key] .
333 " cannot be used with PARAM_TYPE " .
334 implode( ', ', (array)$prohibitedTypes )
338 if ( isset( $config[ApiBase
::PARAM_DFLT
] ) ) {
340 isset( $config[ApiBase
::PARAM_REQUIRED
] ) &&
341 $config[ApiBase
::PARAM_REQUIRED
],
342 "$param: A required parameter cannot have a default" );
344 $this->validateDefault( $param, $config );
347 if ( $config[ApiBase
::PARAM_TYPE
] === 'limit' ) {
349 isset( $config[ApiBase
::PARAM_MAX
] ) &&
350 isset( $config[ApiBase
::PARAM_MAX2
] ),
351 "$param: PARAM_MAX and PARAM_MAX2 are required for limits"
353 $this->assertGreaterThanOrEqual(
354 $config[ApiBase
::PARAM_MAX
],
355 $config[ApiBase
::PARAM_MAX2
],
356 "$param: PARAM_MAX cannot be greater than PARAM_MAX2"
361 isset( $config[ApiBase
::PARAM_MIN
] ) &&
362 isset( $config[ApiBase
::PARAM_MAX
] )
364 $this->assertGreaterThanOrEqual(
365 $config[ApiBase
::PARAM_MIN
],
366 $config[ApiBase
::PARAM_MAX
],
367 "$param: PARAM_MIN cannot be greater than PARAM_MAX"
371 if ( isset( $config[ApiBase
::PARAM_RANGE_ENFORCE
] ) ) {
373 isset( $config[ApiBase
::PARAM_MIN
] ) ||
374 isset( $config[ApiBase
::PARAM_MAX
] ),
375 "$param: PARAM_RANGE_ENFORCE can only be set together with " .
376 "PARAM_MIN or PARAM_MAX"
380 if ( isset( $config[ApiBase
::PARAM_DEPRECATED_VALUES
] ) ) {
381 foreach ( $config[ApiBase
::PARAM_DEPRECATED_VALUES
] as $key => $unused ) {
382 $this->assertContains( $key, $config[ApiBase
::PARAM_TYPE
],
383 "$param: Deprecated value \"$key\" is not allowed, " .
384 "how can it be deprecated?" );
389 isset( $config[ApiBase
::PARAM_ISMULTI_LIMIT1
] ) ||
390 isset( $config[ApiBase
::PARAM_ISMULTI_LIMIT2
] )
392 $this->assertGreaterThanOrEqual( 0, $config[ApiBase
::PARAM_ISMULTI_LIMIT1
],
393 "$param: PARAM_ISMULTI_LIMIT1 cannot be negative" );
394 // Zero for both doesn't make sense, but you could have
396 $this->assertGreaterThanOrEqual( 1, $config[ApiBase
::PARAM_ISMULTI_LIMIT2
],
397 "$param: PARAM_ISMULTI_LIMIT2 cannot be negative or zero" );
398 $this->assertGreaterThanOrEqual(
399 $config[ApiBase
::PARAM_ISMULTI_LIMIT1
],
400 $config[ApiBase
::PARAM_ISMULTI_LIMIT2
],
401 "$param: PARAM_ISMULTI limit cannot be smaller for users with " .
402 "apihighlimits rights" );
405 if ( isset( $config[ApiBase
::PARAM_MAX_BYTES
] ) ) {
406 $this->assertGreaterThanOrEqual( 1, $config[ApiBase
::PARAM_MAX_BYTES
],
407 "$param: PARAM_MAX_BYTES cannot be negative or zero" );
410 if ( isset( $config[ApiBase
::PARAM_MAX_CHARS
] ) ) {
411 $this->assertGreaterThanOrEqual( 1, $config[ApiBase
::PARAM_MAX_CHARS
],
412 "$param: PARAM_MAX_CHARS cannot be negative or zero" );
416 isset( $config[ApiBase
::PARAM_MAX_BYTES
] ) &&
417 isset( $config[ApiBase
::PARAM_MAX_CHARS
] )
419 // Length of a string in chars is always <= length in bytes,
420 // so PARAM_MAX_CHARS is pointless if > PARAM_MAX_BYTES
421 $this->assertGreaterThanOrEqual(
422 $config[ApiBase
::PARAM_MAX_CHARS
],
423 $config[ApiBase
::PARAM_MAX_BYTES
],
424 "$param: PARAM_MAX_BYTES cannot be less than PARAM_MAX_CHARS"
428 if ( isset( $config[ApiBase
::PARAM_TEMPLATE_VARS
] ) ) {
429 $this->assertNotSame( [], $config[ApiBase
::PARAM_TEMPLATE_VARS
],
430 "$param: PARAM_TEMPLATE_VARS cannot be empty" );
431 foreach ( $config[ApiBase
::PARAM_TEMPLATE_VARS
] as $key => $target ) {
432 $this->assertRegExp( '/^[^{}]+$/', $key,
433 "$param: PARAM_TEMPLATE_VARS key may not contain '{' or '}'" );
435 $this->assertContains( '{' . $key . '}', $param,
436 "$param: Name must contain PARAM_TEMPLATE_VARS key {" . $key . "}" );
437 $this->assertArrayHasKey( $target, $params,
438 "$param: PARAM_TEMPLATE_VARS target parameter '$target' does not exist" );
439 $config2 = $params[$target];
440 $this->assertTrue( !empty( $config2[ApiBase
::PARAM_ISMULTI
] ),
441 "$param: PARAM_TEMPLATE_VARS target parameter '$target' must have PARAM_ISMULTI = true" );
443 if ( isset( $config2[ApiBase
::PARAM_TEMPLATE_VARS
] ) ) {
444 $this->assertNotSame( $param, $target,
445 "$param: PARAM_TEMPLATE_VARS cannot target itself" );
447 $this->assertArraySubset(
448 $config2[ApiBase
::PARAM_TEMPLATE_VARS
],
449 $config[ApiBase
::PARAM_TEMPLATE_VARS
],
451 "$param: PARAM_TEMPLATE_VARS target parameter '$target': "
452 . "the target's PARAM_TEMPLATE_VARS must be a subset of the original."
457 $keys = implode( '|',
460 return preg_quote( $key, '/' );
462 array_keys( $config[ApiBase
::PARAM_TEMPLATE_VARS
] )
465 $this->assertRegExp( '/^(?>[^{}]+|\{(?:' . $keys . ')\})+$/', $param,
466 "$param: Name may not contain '{' or '}' other than as defined by PARAM_TEMPLATE_VARS" );
468 $this->assertRegExp( '/^[^{}]+$/', $param,
469 "$param: Name may not contain '{' or '}' without PARAM_TEMPLATE_VARS" );
476 * Throws if $value does not match one of the types specified in $types.
478 * @param array $types From self::$paramTypes array
479 * @param mixed $value Value to check
480 * @param string $param Name of param we're checking, for error messages
481 * @param string $desc Description for error messages
483 private function validateType( $types, $value, $param, $desc ) {
484 if ( count( $types ) === 1 ) {
485 // Only one type allowed
486 if ( is_string( $types[0] ) ) {
487 $this->assertType( $types[0], $value, "$param: $desc type" );
489 // Array whose values have specified types, recurse
490 $this->assertInternalType( 'array', $value, "$param: $desc type" );
491 foreach ( $value as $subvalue ) {
492 $this->validateType( $types[0], $subvalue, $param, "$desc value" );
497 foreach ( $types as $type ) {
498 if ( is_string( $type ) ) {
499 if ( class_exists( $type ) ||
interface_exists( $type ) ) {
500 if ( $value instanceof $type ) {
504 if ( gettype( $value ) === $type ) {
509 // Array whose values have specified types, recurse
511 $this->validateType( [ $type ], $value, $param, "$desc type" );
512 // Didn't throw, so we're good
514 } catch ( Exception
$unused ) {
518 // Doesn't match any of them
519 $this->fail( "$param: $desc has incorrect type" );
524 * Asserts that $default is a valid default for $type.
526 * @param string $param Name of param, for error messages
527 * @param array $config Array of configuration options for this parameter
529 private function validateDefault( $param, $config ) {
530 $type = $config[ApiBase
::PARAM_TYPE
];
531 $default = $config[ApiBase
::PARAM_DFLT
];
533 if ( !empty( $config[ApiBase
::PARAM_ISMULTI
] ) ) {
534 if ( $default === '' ) {
535 // The empty array is fine
538 $defaults = explode( '|', $default );
539 $config[ApiBase
::PARAM_ISMULTI
] = false;
540 foreach ( $defaults as $defaultValue ) {
541 // Only allow integers in their simplest form with no leading
542 // or trailing characters etc.
543 if ( $type === 'integer' && $defaultValue === (string)(int)$defaultValue ) {
544 $defaultValue = (int)$defaultValue;
546 $config[ApiBase
::PARAM_DFLT
] = $defaultValue;
547 $this->validateDefault( $param, $config );
553 $this->assertFalse( $default,
554 "$param: Boolean params may only default to false" );
558 $this->assertInternalType( 'integer', $default,
559 "$param: Default $default is not an integer" );
563 if ( $default === 'max' ) {
566 $this->assertInternalType( 'integer', $default,
567 "$param: Default $default is neither an integer nor \"max\"" );
571 $validValues = MWNamespace
::getValidNamespaces();
573 isset( $config[ApiBase
::PARAM_EXTRA_NAMESPACES
] ) &&
574 is_array( $config[ApiBase
::PARAM_EXTRA_NAMESPACES
] )
576 $validValues = array_merge(
578 $config[ApiBase
::PARAM_EXTRA_NAMESPACES
]
581 $this->assertContains( $default, $validValues,
582 "$param: Default $default is not a valid namespace" );
591 $this->assertInternalType( 'string', $default,
592 "$param: Default $default is not a string" );
596 if ( $default === 'now' ) {
599 $this->assertNotFalse( wfTimestamp( TS_MW
, $default ),
600 "$param: Default $default is not a valid timestamp" );
604 // @todo Should we make user validation a public static method
605 // in ApiBase() or something so we don't have to resort to
606 // this? Or in User for that matter.
607 $wrapper = TestingAccessWrapper
::newFromObject( new ApiMain() );
609 $wrapper->validateUser( $default, '' );
610 } catch ( ApiUsageException
$e ) {
611 $this->fail( "$param: Default $default is not a valid username/IP address" );
616 if ( is_array( $type ) ) {
617 $this->assertContains( $default, $type,
618 "$param: Default $default is not any of " .
619 implode( ', ', $type ) );
621 $this->fail( "Unrecognized type $type" );
627 * @return array List of API module paths to test
629 public static function provideParameterConsistency() {
630 $main = self
::getMain();
631 $paths = self
::getSubModulePaths( $main->getModuleManager() );
632 array_unshift( $paths, $main->getModulePath() );
635 foreach ( $paths as $path ) {
642 * Return paths of all submodules in an ApiModuleManager, recursively
643 * @param ApiModuleManager $manager
646 protected static function getSubModulePaths( ApiModuleManager
$manager ) {
648 foreach ( $manager->getNames() as $name ) {
649 $module = $manager->getModule( $name );
650 $paths[] = $module->getModulePath();
651 $subManager = $module->getModuleManager();
653 $paths = array_merge( $paths, self
::getSubModulePaths( $subManager ) );