4 * Verifies that special page aliases are valid, with no slashes.
7 * @group SpecialPageAliases
11 * @licence GNU GPL v2+
12 * @author Katie Filbert < aude.wiki@gmail.com >
14 class SpecialPageAliasTest
extends MediaWikiTestCase
{
17 * @dataProvider validSpecialPageAliasesProvider
19 public function testValidSpecialPageAliases( $code, $specialPageAliases ) {
20 foreach ( $specialPageAliases as $specialPage => $aliases ) {
21 foreach ( $aliases as $alias ) {
22 $msg = "$specialPage alias '$alias' in $code is valid with no slashes";
23 $this->assertRegExp( '/^[^\/]*$/', $msg );
28 public function validSpecialPageAliasesProvider() {
29 $codes = array_keys( Language
::fetchLanguageNames( 'mwfile' ) );
33 foreach ( $codes as $code ) {
34 $specialPageAliases = $this->getSpecialPageAliases( $code );
36 if ( $specialPageAliases !== array() ) {
37 $data[] = array( $code, $specialPageAliases );
49 protected function getSpecialPageAliases( $code ) {
50 $file = Language
::getMessagesFileName( $code );
52 if ( is_readable( $file ) ) {
55 if ( isset( $specialPageAliases ) && $specialPageAliases !== null ) {
56 return $specialPageAliases;