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 $modules = $query->getModuleManager()->getNamesWithClasses();
16 foreach ( $modules as $name => $class ) {
17 /** @var ApiMain $module */
18 $module = new $class( $main, $name );
19 $prefix = $module->getModulePrefix();
20 if ( isset( $prefixes[$prefix] ) ) {
21 $this->fail( "Module prefix '{$prefix}' is shared between {$class} and {$prefixes[$prefix]}" );
23 $prefixes[$module->getModulePrefix()] = $class;
25 $this->assertTrue( true ); // dummy call to make this test non-incomplete