Added release notes for 'ContentHandler::runLegacyHooks' removal
[mediawiki.git] / tests / phpunit / includes / api / PrefixUniquenessTest.php
blobd125a7d531312845c8f9aa6405d175cc34b02aea
1 <?php
3 /**
4 * Checks that all API query modules, core and extensions, have unique prefixes.
6 * @group API
7 */
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();
16 $prefixes = [];
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