4 * Checks that all API query modules, core and extensions, have unique prefixes.
8 class PrefixUniquenessTest
extends MediaWikiTestCase
{
10 public function testPrefixes() {
11 $main = new ApiMain( new FauxRequest() );
12 $query = new ApiQuery( $main, 'foo', 'bar' );
13 $moduleManager = $query->getModuleManager();
15 $modules = $moduleManager->getNames();
18 foreach ( $modules as $name ) {
19 $module = $moduleManager->getModule( $name );
20 $class = get_class( $module );
22 $prefix = $module->getModulePrefix();
23 if ( $prefix !== '' && isset( $prefixes[$prefix] ) ) {
24 $this->fail( "Module prefix '{$prefix}' is shared between {$class} and {$prefixes[$prefix]}" );
26 $prefixes[$module->getModulePrefix()] = $class;
28 $this->assertTrue( true ); // dummy call to make this test non-incomplete