wiki.techinc.nl/tests/phpunit/includes/api/PrefixUniquenessTest.php
Yuri Astrakhan 62216932c1 API PageSet allows generator for non-query modules
* PageSet can now be used in any action to process titles/pageids/revids
or any generator, redirects resolution, and converttitle functionality.
* action=purge proper usage of MustBePosted()
* Add supports for all pageset capabilities - generators, redirects, converttitles to
  action=purge and action=setnotificationtimestamp
* BREAKING CHANGE: ApiPageSet constructor now has two params instead of three, with only the
  first one keeping its meaning. ApiPageSet is now derived from ApiBase.
* BREAKING CHANGE: ApiQuery::newGenerator() and executeGeneratorModule() were deleted.

Change-Id: I7a3d7b6eb015d21ec1a9b9d9c6af9d97663f3f9a
2013-02-08 15:42:21 -05:00

25 lines
789 B
PHP

<?php
/**
* Checks that all API query modules, core and extensions, have unique prefixes.
*
* @group API
*/
class PrefixUniquenessTest extends MediaWikiTestCase {
public function testPrefixes() {
$main = new ApiMain( new FauxRequest() );
$query = new ApiQuery( $main, 'foo', 'bar' );
$modules = $query->getModuleManager()->getNamesWithClasses();
$prefixes = array();
foreach ( $modules as $name => $class ) {
$module = new $class( $main, $name );
$prefix = $module->getModulePrefix();
if ( isset( $prefixes[$prefix] ) ) {
$this->fail( "Module prefix '{$prefix}' is shared between {$class} and {$prefixes[$prefix]}" );
}
$prefixes[$module->getModulePrefix()] = $class;
}
$this->assertTrue( true ); // dummy call to make this test non-incomplete
}
}