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
14 class ApiStructureTest
extends MediaWikiTestCase
{
19 /** @var array Sets of globals to test. Each array element is input to HashConfig */
20 private static $testGlobals = [
30 * Values are an array, where each array value is a permitted type. A type
31 * can be a string, which is the name of an internal type or a
32 * class/interface. Or it can be an array, in which case the value must be
33 * an array whose elements are the types given in the array (e.g., [
34 * 'string', integer' ] means an array whose entries are strings and/or
37 private static $paramTypes = [
38 // ApiBase::PARAM_DFLT => as appropriate for PARAM_TYPE
39 ApiBase
::PARAM_ISMULTI
=> [ 'boolean' ],
40 ApiBase
::PARAM_TYPE
=> [ 'string', [ 'string' ] ],
41 ApiBase
::PARAM_MAX
=> [ 'integer' ],
42 ApiBase
::PARAM_MAX2
=> [ 'integer' ],
43 ApiBase
::PARAM_MIN
=> [ 'integer' ],
44 ApiBase
::PARAM_ALLOW_DUPLICATES
=> [ 'boolean' ],
45 ApiBase
::PARAM_DEPRECATED
=> [ 'boolean' ],
46 ApiBase
::PARAM_REQUIRED
=> [ 'boolean' ],
47 ApiBase
::PARAM_RANGE_ENFORCE
=> [ 'boolean' ],
48 ApiBase
::PARAM_HELP_MSG
=> [ 'string', 'array', Message
::class ],
49 ApiBase
::PARAM_HELP_MSG_APPEND
=> [ [ 'string', 'array', Message
::class ] ],
50 ApiBase
::PARAM_HELP_MSG_INFO
=> [ [ 'array' ] ],
51 ApiBase
::PARAM_VALUE_LINKS
=> [ [ 'string' ] ],
52 ApiBase
::PARAM_HELP_MSG_PER_VALUE
=> [ [ 'string', 'array', Message
::class ] ],
53 ApiBase
::PARAM_SUBMODULE_MAP
=> [ [ 'string' ] ],
54 ApiBase
::PARAM_SUBMODULE_PARAM_PREFIX
=> [ 'string' ],
55 ApiBase
::PARAM_ALL
=> [ 'boolean', 'string' ],
56 ApiBase
::PARAM_EXTRA_NAMESPACES
=> [ [ 'integer' ] ],
57 ApiBase
::PARAM_SENSITIVE
=> [ 'boolean' ],
58 ApiBase
::PARAM_DEPRECATED_VALUES
=> [ 'array' ],
59 ApiBase
::PARAM_ISMULTI_LIMIT1
=> [ 'integer' ],
60 ApiBase
::PARAM_ISMULTI_LIMIT2
=> [ 'integer' ],
61 ApiBase
::PARAM_MAX_BYTES
=> [ 'integer' ],
62 ApiBase
::PARAM_MAX_CHARS
=> [ 'integer' ],
63 ApiBase
::PARAM_TEMPLATE_VARS
=> [ 'array' ],
66 // param => [ other param that must be present => required value or null ]
67 private static $paramRequirements = [
68 ApiBase
::PARAM_ALLOW_DUPLICATES
=> [ ApiBase
::PARAM_ISMULTI
=> true ],
69 ApiBase
::PARAM_ALL
=> [ ApiBase
::PARAM_ISMULTI
=> true ],
70 ApiBase
::PARAM_ISMULTI_LIMIT1
=> [
71 ApiBase
::PARAM_ISMULTI
=> true,
72 ApiBase
::PARAM_ISMULTI_LIMIT2
=> null,
74 ApiBase
::PARAM_ISMULTI_LIMIT2
=> [
75 ApiBase
::PARAM_ISMULTI
=> true,
76 ApiBase
::PARAM_ISMULTI_LIMIT1
=> null,
80 // param => type(s) allowed for this param ('array' is any array)
81 private static $paramAllowedTypes = [
82 ApiBase
::PARAM_MAX
=> [ 'integer', 'limit' ],
83 ApiBase
::PARAM_MAX2
=> 'limit',
84 ApiBase
::PARAM_MIN
=> [ 'integer', 'limit' ],
85 ApiBase
::PARAM_RANGE_ENFORCE
=> 'integer',
86 ApiBase
::PARAM_VALUE_LINKS
=> 'array',
87 ApiBase
::PARAM_HELP_MSG_PER_VALUE
=> 'array',
88 ApiBase
::PARAM_SUBMODULE_MAP
=> 'submodule',
89 ApiBase
::PARAM_SUBMODULE_PARAM_PREFIX
=> 'submodule',
90 ApiBase
::PARAM_ALL
=> 'array',
91 ApiBase
::PARAM_EXTRA_NAMESPACES
=> 'namespace',
92 ApiBase
::PARAM_DEPRECATED_VALUES
=> 'array',
93 ApiBase
::PARAM_MAX_BYTES
=> [ 'NULL', 'string', 'text', 'password' ],
94 ApiBase
::PARAM_MAX_CHARS
=> [ 'NULL', 'string', 'text', 'password' ],
97 private static $paramProhibitedTypes = [
98 ApiBase
::PARAM_ISMULTI
=> [ 'boolean', 'limit', 'upload' ],
99 ApiBase
::PARAM_ALL
=> 'namespace',
100 ApiBase
::PARAM_SENSITIVE
=> 'password',
103 private static $constantNames = null;
106 * Initialize/fetch the ApiMain instance for testing
109 private static function getMain() {
110 if ( !self
::$main ) {
111 self
::$main = new ApiMain( RequestContext
::getMain() );
112 self
::$main->getContext()->setLanguage( 'en' );
113 self
::$main->getContext()->setTitle(
114 Title
::makeTitle( NS_SPECIAL
, 'Badtitle/dummy title for ApiStructureTest' )
122 * @param Message $msg
123 * @param string $what Which message is being checked
125 private function checkMessage( $msg, $what ) {
126 $msg = ApiBase
::makeMessage( $msg, self
::getMain()->getContext() );
127 $this->assertInstanceOf( Message
::class, $msg, "$what message" );
128 $this->assertTrue( $msg->exists(), "$what message {$msg->getKey()} exists" );
132 * @dataProvider provideDocumentationExists
133 * @param string $path Module path
134 * @param array $globals Globals to set
136 public function testDocumentationExists( $path, array $globals ) {
137 $main = self
::getMain();
139 // Set configuration variables
140 $main->getContext()->setConfig( new MultiConfig( [
141 new HashConfig( $globals ),
142 RequestContext
::getMain()->getConfig(),
144 foreach ( $globals as $k => $v ) {
145 $this->setMwGlobals( "wg$k", $v );
149 $module = TestingAccessWrapper
::newFromObject( $main->getModuleFromPath( $path ) );
151 // Test messages for flags.
152 foreach ( $module->getHelpFlags() as $flag ) {
153 $this->checkMessage( "api-help-flag-$flag", "Flag $flag" );
156 // Module description messages.
157 $this->checkMessage( $module->getSummaryMessage(), 'Module summary' );
158 $this->checkMessage( $module->getExtendedDescription(), 'Module help top text' );
160 // Parameters. Lots of messages in here.
161 $params = $module->getFinalParams( ApiBase
::GET_VALUES_FOR_HELP
);
163 foreach ( $params as $name => $settings ) {
164 if ( !is_array( $settings ) ) {
168 // Basic description message
169 if ( isset( $settings[ApiBase
::PARAM_HELP_MSG
] ) ) {
170 $msg = $settings[ApiBase
::PARAM_HELP_MSG
];
172 $msg = "apihelp-{$path}-param-{$name}";
174 $this->checkMessage( $msg, "Parameter $name description" );
176 // If param-per-value is in use, each value's message
177 if ( isset( $settings[ApiBase
::PARAM_HELP_MSG_PER_VALUE
] ) ) {
178 $this->assertInternalType( 'array', $settings[ApiBase
::PARAM_HELP_MSG_PER_VALUE
],
179 "Parameter $name PARAM_HELP_MSG_PER_VALUE is array" );
180 $this->assertInternalType( 'array', $settings[ApiBase
::PARAM_TYPE
],
181 "Parameter $name PARAM_TYPE is array for msg-per-value mode" );
182 $valueMsgs = $settings[ApiBase
::PARAM_HELP_MSG_PER_VALUE
];
183 foreach ( $settings[ApiBase
::PARAM_TYPE
] as $value ) {
184 if ( isset( $valueMsgs[$value] ) ) {
185 $msg = $valueMsgs[$value];
187 $msg = "apihelp-{$path}-paramvalue-{$name}-{$value}";
189 $this->checkMessage( $msg, "Parameter $name value $value" );
193 // Appended messages (e.g. "disabled in miser mode")
194 if ( isset( $settings[ApiBase
::PARAM_HELP_MSG_APPEND
] ) ) {
195 $this->assertInternalType( 'array', $settings[ApiBase
::PARAM_HELP_MSG_APPEND
],
196 "Parameter $name PARAM_HELP_MSG_APPEND is array" );
197 foreach ( $settings[ApiBase
::PARAM_HELP_MSG_APPEND
] as $i => $msg ) {
198 $this->checkMessage( $msg, "Parameter $name HELP_MSG_APPEND #$i" );
202 // Info tags (e.g. "only usable in mode 1") are typically shared by
203 // several parameters, so accumulate them and test them later.
204 if ( !empty( $settings[ApiBase
::PARAM_HELP_MSG_INFO
] ) ) {
205 foreach ( $settings[ApiBase
::PARAM_HELP_MSG_INFO
] as $i ) {
206 $tags[array_shift( $i )] = 1;
211 // Info tags (e.g. "only usable in mode 1") accumulated above
212 foreach ( $tags as $tag => $dummy ) {
213 $this->checkMessage( "apihelp-{$path}-paraminfo-{$tag}", "HELP_MSG_INFO tag $tag" );
216 // Messages for examples.
217 foreach ( $module->getExamplesMessages() as $qs => $msg ) {
218 $this->assertStringStartsNotWith( 'api.php?', $qs,
219 "Query string must not begin with 'api.php?'" );
220 $this->checkMessage( $msg, "Example $qs" );
224 public static function provideDocumentationExists() {
225 $main = self
::getMain();
226 $paths = self
::getSubModulePaths( $main->getModuleManager() );
227 array_unshift( $paths, $main->getModulePath() );
230 foreach ( $paths as $path ) {
231 foreach ( self
::$testGlobals as $globals ) {
233 foreach ( $globals as $k => $v ) {
234 $g[] = "$k=" . var_export( $v, 1 );
236 $k = "Module $path with " . implode( ', ', $g );
237 $ret[$k] = [ $path, $globals ];
244 * @dataProvider provideParameterConsistency
245 * @param string $path
247 public function testParameterConsistency( $path ) {
248 $main = self
::getMain();
249 $module = TestingAccessWrapper
::newFromObject( $main->getModuleFromPath( $path ) );
251 $paramsPlain = $module->getFinalParams();
252 $paramsForHelp = $module->getFinalParams( ApiBase
::GET_VALUES_FOR_HELP
);
254 // avoid warnings about empty tests when no parameter needs to be checked
255 $this->assertTrue( true );
257 if ( self
::$constantNames === null ) {
258 self
::$constantNames = [];
260 foreach ( ( new ReflectionClass( 'ApiBase' ) )->getConstants() as $key => $val ) {
261 if ( substr( $key, 0, 6 ) === 'PARAM_' ) {
262 self
::$constantNames[$val] = $key;
267 foreach ( [ $paramsPlain, $paramsForHelp ] as $params ) {
268 foreach ( $params as $param => $config ) {
269 if ( !is_array( $config ) ) {
270 $config = [ ApiBase
::PARAM_DFLT
=> $config ];
272 if ( !isset( $config[ApiBase
::PARAM_TYPE
] ) ) {
273 $config[ApiBase
::PARAM_TYPE
] = isset( $config[ApiBase
::PARAM_DFLT
] )
274 ?
gettype( $config[ApiBase
::PARAM_DFLT
] )
278 foreach ( self
::$paramTypes as $key => $types ) {
279 if ( !isset( $config[$key] ) ) {
282 $keyName = self
::$constantNames[$key];
283 $this->validateType( $types, $config[$key], $param, $keyName );
286 foreach ( self
::$paramRequirements as $key => $required ) {
287 if ( !isset( $config[$key] ) ) {
290 foreach ( $required as $requireKey => $requireVal ) {
291 $this->assertArrayHasKey( $requireKey, $config,
292 "$param: When " . self
::$constantNames[$key] . " is set, " .
293 self
::$constantNames[$requireKey] . " must also be set" );
294 if ( $requireVal !== null ) {
295 $this->assertSame( $requireVal, $config[$requireKey],
296 "$param: When " . self
::$constantNames[$key] . " is set, " .
297 self
::$constantNames[$requireKey] . " must equal " .
298 var_export( $requireVal, true ) );
303 foreach ( self
::$paramAllowedTypes as $key => $allowedTypes ) {
304 if ( !isset( $config[$key] ) ) {
308 $actualType = is_array( $config[ApiBase
::PARAM_TYPE
] )
309 ?
'array' : $config[ApiBase
::PARAM_TYPE
];
311 $this->assertContains(
313 (array)$allowedTypes,
314 "$param: " . self
::$constantNames[$key] .
315 " can only be used with PARAM_TYPE " .
316 implode( ', ', (array)$allowedTypes )
320 foreach ( self
::$paramProhibitedTypes as $key => $prohibitedTypes ) {
321 if ( !isset( $config[$key] ) ) {
325 $actualType = is_array( $config[ApiBase
::PARAM_TYPE
] )
326 ?
'array' : $config[ApiBase
::PARAM_TYPE
];
328 $this->assertNotContains(
330 (array)$prohibitedTypes,
331 "$param: " . self
::$constantNames[$key] .
332 " cannot be used with PARAM_TYPE " .
333 implode( ', ', (array)$prohibitedTypes )
337 if ( isset( $config[ApiBase
::PARAM_DFLT
] ) ) {
339 isset( $config[ApiBase
::PARAM_REQUIRED
] ) &&
340 $config[ApiBase
::PARAM_REQUIRED
],
341 "$param: A required parameter cannot have a default" );
343 $this->validateDefault( $param, $config );
346 if ( $config[ApiBase
::PARAM_TYPE
] === 'limit' ) {
348 isset( $config[ApiBase
::PARAM_MAX
] ) &&
349 isset( $config[ApiBase
::PARAM_MAX2
] ),
350 "$param: PARAM_MAX and PARAM_MAX2 are required for limits"
352 $this->assertGreaterThanOrEqual(
353 $config[ApiBase
::PARAM_MAX
],
354 $config[ApiBase
::PARAM_MAX2
],
355 "$param: PARAM_MAX cannot be greater than PARAM_MAX2"
360 isset( $config[ApiBase
::PARAM_MIN
] ) &&
361 isset( $config[ApiBase
::PARAM_MAX
] )
363 $this->assertGreaterThanOrEqual(
364 $config[ApiBase
::PARAM_MIN
],
365 $config[ApiBase
::PARAM_MAX
],
366 "$param: PARAM_MIN cannot be greater than PARAM_MAX"
370 if ( isset( $config[ApiBase
::PARAM_RANGE_ENFORCE
] ) ) {
372 isset( $config[ApiBase
::PARAM_MIN
] ) ||
373 isset( $config[ApiBase
::PARAM_MAX
] ),
374 "$param: PARAM_RANGE_ENFORCE can only be set together with " .
375 "PARAM_MIN or PARAM_MAX"
379 if ( isset( $config[ApiBase
::PARAM_DEPRECATED_VALUES
] ) ) {
380 foreach ( $config[ApiBase
::PARAM_DEPRECATED_VALUES
] as $key => $unused ) {
381 $this->assertContains( $key, $config[ApiBase
::PARAM_TYPE
],
382 "$param: Deprecated value \"$key\" is not allowed, " .
383 "how can it be deprecated?" );
388 isset( $config[ApiBase
::PARAM_ISMULTI_LIMIT1
] ) ||
389 isset( $config[ApiBase
::PARAM_ISMULTI_LIMIT2
] )
391 $this->assertGreaterThanOrEqual( 0, $config[ApiBase
::PARAM_ISMULTI_LIMIT1
],
392 "$param: PARAM_ISMULTI_LIMIT1 cannot be negative" );
393 // Zero for both doesn't make sense, but you could have
395 $this->assertGreaterThanOrEqual( 1, $config[ApiBase
::PARAM_ISMULTI_LIMIT2
],
396 "$param: PARAM_ISMULTI_LIMIT2 cannot be negative or zero" );
397 $this->assertGreaterThanOrEqual(
398 $config[ApiBase
::PARAM_ISMULTI_LIMIT1
],
399 $config[ApiBase
::PARAM_ISMULTI_LIMIT2
],
400 "$param: PARAM_ISMULTI limit cannot be smaller for users with " .
401 "apihighlimits rights" );
404 if ( isset( $config[ApiBase
::PARAM_MAX_BYTES
] ) ) {
405 $this->assertGreaterThanOrEqual( 1, $config[ApiBase
::PARAM_MAX_BYTES
],
406 "$param: PARAM_MAX_BYTES cannot be negative or zero" );
409 if ( isset( $config[ApiBase
::PARAM_MAX_CHARS
] ) ) {
410 $this->assertGreaterThanOrEqual( 1, $config[ApiBase
::PARAM_MAX_CHARS
],
411 "$param: PARAM_MAX_CHARS cannot be negative or zero" );
415 isset( $config[ApiBase
::PARAM_MAX_BYTES
] ) &&
416 isset( $config[ApiBase
::PARAM_MAX_CHARS
] )
418 // Length of a string in chars is always <= length in bytes,
419 // so PARAM_MAX_CHARS is pointless if > PARAM_MAX_BYTES
420 $this->assertGreaterThanOrEqual(
421 $config[ApiBase
::PARAM_MAX_CHARS
],
422 $config[ApiBase
::PARAM_MAX_BYTES
],
423 "$param: PARAM_MAX_BYTES cannot be less than PARAM_MAX_CHARS"
427 if ( isset( $config[ApiBase
::PARAM_TEMPLATE_VARS
] ) ) {
428 $this->assertNotSame( [], $config[ApiBase
::PARAM_TEMPLATE_VARS
],
429 "$param: PARAM_TEMPLATE_VARS cannot be empty" );
430 foreach ( $config[ApiBase
::PARAM_TEMPLATE_VARS
] as $key => $target ) {
431 $this->assertRegExp( '/^[^{}]+$/', $key,
432 "$param: PARAM_TEMPLATE_VARS key may not contain '{' or '}'" );
434 $this->assertContains( '{' . $key . '}', $param,
435 "$param: Name must contain PARAM_TEMPLATE_VARS key {" . $key . "}" );
436 $this->assertArrayHasKey( $target, $params,
437 "$param: PARAM_TEMPLATE_VARS target parameter '$target' does not exist" );
438 $config2 = $params[$target];
439 $this->assertTrue( !empty( $config2[ApiBase
::PARAM_ISMULTI
] ),
440 "$param: PARAM_TEMPLATE_VARS target parameter '$target' must have PARAM_ISMULTI = true" );
442 if ( isset( $config2[ApiBase
::PARAM_TEMPLATE_VARS
] ) ) {
443 $this->assertNotSame( $param, $target,
444 "$param: PARAM_TEMPLATE_VARS cannot target itself" );
446 $this->assertArraySubset(
447 $config2[ApiBase
::PARAM_TEMPLATE_VARS
],
448 $config[ApiBase
::PARAM_TEMPLATE_VARS
],
450 "$param: PARAM_TEMPLATE_VARS target parameter '$target': "
451 . "the target's PARAM_TEMPLATE_VARS must be a subset of the original."
456 $keys = implode( '|',
459 return preg_quote( $key, '/' );
461 array_keys( $config[ApiBase
::PARAM_TEMPLATE_VARS
] )
464 $this->assertRegExp( '/^(?>[^{}]+|\{(?:' . $keys . ')\})+$/', $param,
465 "$param: Name may not contain '{' or '}' other than as defined by PARAM_TEMPLATE_VARS" );
467 $this->assertRegExp( '/^[^{}]+$/', $param,
468 "$param: Name may not contain '{' or '}' without PARAM_TEMPLATE_VARS" );
475 * Throws if $value does not match one of the types specified in $types.
477 * @param array $types From self::$paramTypes array
478 * @param mixed $value Value to check
479 * @param string $param Name of param we're checking, for error messages
480 * @param string $desc Description for error messages
482 private function validateType( $types, $value, $param, $desc ) {
483 if ( count( $types ) === 1 ) {
484 // Only one type allowed
485 if ( is_string( $types[0] ) ) {
486 $this->assertType( $types[0], $value, "$param: $desc type" );
488 // Array whose values have specified types, recurse
489 $this->assertInternalType( 'array', $value, "$param: $desc type" );
490 foreach ( $value as $subvalue ) {
491 $this->validateType( $types[0], $subvalue, $param, "$desc value" );
496 foreach ( $types as $type ) {
497 if ( is_string( $type ) ) {
498 if ( class_exists( $type ) ||
interface_exists( $type ) ) {
499 if ( $value instanceof $type ) {
503 if ( gettype( $value ) === $type ) {
508 // Array whose values have specified types, recurse
510 $this->validateType( [ $type ], $value, $param, "$desc type" );
511 // Didn't throw, so we're good
513 } catch ( Exception
$unused ) {
517 // Doesn't match any of them
518 $this->fail( "$param: $desc has incorrect type" );
523 * Asserts that $default is a valid default for $type.
525 * @param string $param Name of param, for error messages
526 * @param array $config Array of configuration options for this parameter
528 private function validateDefault( $param, $config ) {
529 $type = $config[ApiBase
::PARAM_TYPE
];
530 $default = $config[ApiBase
::PARAM_DFLT
];
532 if ( !empty( $config[ApiBase
::PARAM_ISMULTI
] ) ) {
533 if ( $default === '' ) {
534 // The empty array is fine
537 $defaults = explode( '|', $default );
538 $config[ApiBase
::PARAM_ISMULTI
] = false;
539 foreach ( $defaults as $defaultValue ) {
540 // Only allow integers in their simplest form with no leading
541 // or trailing characters etc.
542 if ( $type === 'integer' && $defaultValue === (string)(int)$defaultValue ) {
543 $defaultValue = (int)$defaultValue;
545 $config[ApiBase
::PARAM_DFLT
] = $defaultValue;
546 $this->validateDefault( $param, $config );
552 $this->assertFalse( $default,
553 "$param: Boolean params may only default to false" );
557 $this->assertInternalType( 'integer', $default,
558 "$param: Default $default is not an integer" );
562 if ( $default === 'max' ) {
565 $this->assertInternalType( 'integer', $default,
566 "$param: Default $default is neither an integer nor \"max\"" );
570 $validValues = MWNamespace
::getValidNamespaces();
572 isset( $config[ApiBase
::PARAM_EXTRA_NAMESPACES
] ) &&
573 is_array( $config[ApiBase
::PARAM_EXTRA_NAMESPACES
] )
575 $validValues = array_merge(
577 $config[ApiBase
::PARAM_EXTRA_NAMESPACES
]
580 $this->assertContains( $default, $validValues,
581 "$param: Default $default is not a valid namespace" );
590 $this->assertInternalType( 'string', $default,
591 "$param: Default $default is not a string" );
595 if ( $default === 'now' ) {
598 $this->assertNotFalse( wfTimestamp( TS_MW
, $default ),
599 "$param: Default $default is not a valid timestamp" );
603 // @todo Should we make user validation a public static method
604 // in ApiBase() or something so we don't have to resort to
605 // this? Or in User for that matter.
606 $wrapper = TestingAccessWrapper
::newFromObject( new ApiMain() );
608 $wrapper->validateUser( $default, '' );
609 } catch ( ApiUsageException
$e ) {
610 $this->fail( "$param: Default $default is not a valid username/IP address" );
615 if ( is_array( $type ) ) {
616 $this->assertContains( $default, $type,
617 "$param: Default $default is not any of " .
618 implode( ', ', $type ) );
620 $this->fail( "Unrecognized type $type" );
626 * @return array List of API module paths to test
628 public static function provideParameterConsistency() {
629 $main = self
::getMain();
630 $paths = self
::getSubModulePaths( $main->getModuleManager() );
631 array_unshift( $paths, $main->getModulePath() );
634 foreach ( $paths as $path ) {
641 * Return paths of all submodules in an ApiModuleManager, recursively
642 * @param ApiModuleManager $manager
645 protected static function getSubModulePaths( ApiModuleManager
$manager ) {
647 foreach ( $manager->getNames() as $name ) {
648 $module = $manager->getModule( $name );
649 $paths[] = $module->getModulePath();
650 $subManager = $module->getModuleManager();
652 $paths = array_merge( $paths, self
::getSubModulePaths( $subManager ) );