Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / api / PrefixUniquenessTest.php
blobd04766be67a7042d6c942ae694b416b9e6d4927e
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 = array();
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