MediaWiki  REL1_22
PrefixUniquenessTest.php
Go to the documentation of this file.
00001 <?php
00002 
00008 class PrefixUniquenessTest extends MediaWikiTestCase {
00009     public function testPrefixes() {
00010         $main = new ApiMain( new FauxRequest() );
00011         $query = new ApiQuery( $main, 'foo', 'bar' );
00012         $modules = $query->getModuleManager()->getNamesWithClasses();
00013         $prefixes = array();
00014 
00015         foreach ( $modules as $name => $class ) {
00016             $module = new $class( $main, $name );
00017             $prefix = $module->getModulePrefix();
00018             if ( isset( $prefixes[$prefix] ) ) {
00019                 $this->fail( "Module prefix '{$prefix}' is shared between {$class} and {$prefixes[$prefix]}" );
00020             }
00021             $prefixes[$module->getModulePrefix()] = $class;
00022         }
00023         $this->assertTrue( true ); // dummy call to make this test non-incomplete
00024     }
00025 }