Remove $wgDebugFunctionEntry, unused
[mediawiki.git] / tests / phpunit / languages / SpecialPageAliasTest.php
blobf6d6bc964335f564a78bd161eb7912dc8a4b5f38
1 <?php
3 /**
4 * Verifies that special page aliases are valid, with no slashes.
6 * @group Language
7 * @group SpecialPageAliases
8 * @group SystemTest
9 * @group medium
11 * @licence GNU GPL v2+
12 * @author Katie Filbert < aude.wiki@gmail.com >
14 class SpecialPageAliasTest extends MediaWikiTestCase {
16 /**
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' ) );
31 $data = array();
33 foreach ( $codes as $code ) {
34 $specialPageAliases = $this->getSpecialPageAliases( $code );
36 if ( $specialPageAliases !== array() ) {
37 $data[] = array( $code, $specialPageAliases );
41 return $data;
44 /**
45 * @param string $code
47 * @return array
49 protected function getSpecialPageAliases( $code ) {
50 $file = Language::getMessagesFileName( $code );
52 if ( is_readable( $file ) ) {
53 include $file;
55 if ( isset( $specialPageAliases ) && $specialPageAliases !== null ) {
56 return $specialPageAliases;
60 return array();