MediaWiki REL1_31
PrefixUniquenessTest.php
Go to the documentation of this file.
1<?php
2
9
10 public function testPrefixes() {
11 $main = new ApiMain( new FauxRequest() );
12 $query = new ApiQuery( $main, 'foo', 'bar' );
13 $moduleManager = $query->getModuleManager();
14
15 $modules = $moduleManager->getNames();
16 $prefixes = [];
17
18 foreach ( $modules as $name ) {
19 $module = $moduleManager->getModule( $name );
20 $class = get_class( $module );
21
22 $prefix = $module->getModulePrefix();
23 if ( $prefix !== '' && isset( $prefixes[$prefix] ) ) {
24 $this->fail( "Module prefix '{$prefix}' is shared between {$class} and {$prefixes[$prefix]}" );
25 }
26 $prefixes[$module->getModulePrefix()] = $class;
27 }
28 $this->assertTrue( true ); // dummy call to make this test non-incomplete
29 }
30}
This is the main API class, used for both external and internal processing.
Definition ApiMain.php:43
This is the main query class.
Definition ApiQuery.php:36
WebRequest clone which takes values from a provided array.
Checks that all API query modules, core and extensions, have unique prefixes.
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition hooks.txt:1620