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