4 * Verifies that special page aliases are valid, with no slashes.
7 * @group SpecialPageAliases
11 * @author Katie Filbert < aude.wiki@gmail.com >
13 class SpecialPageAliasTest
extends MediaWikiTestCase
{
16 * @dataProvider validSpecialPageAliasesProvider
18 public function testValidSpecialPageAliases( $code, $specialPageAliases ) {
19 foreach ( $specialPageAliases as $specialPage => $aliases ) {
20 foreach ( $aliases as $alias ) {
21 $msg = "$specialPage alias '$alias' in $code is valid with no slashes";
22 $this->assertRegExp( '/^[^\/]*$/', $msg );
27 public function validSpecialPageAliasesProvider() {
28 $codes = array_keys( Language
::fetchLanguageNames( 'mwfile' ) );
32 foreach ( $codes as $code ) {
33 $specialPageAliases = $this->getSpecialPageAliases( $code );
35 if ( $specialPageAliases !== [] ) {
36 $data[] = [ $code, $specialPageAliases ];
48 protected function getSpecialPageAliases( $code ) {
49 $file = Language
::getMessagesFileName( $code );
51 if ( is_readable( $file ) ) {
54 if ( isset( $specialPageAliases ) && $specialPageAliases !== null ) {
55 return $specialPageAliases;