From c2743edd269996ebeddc3315bce9862916a9d4ae Mon Sep 17 00:00:00 2001 From: Ammarpad Date: Thu, 14 Jan 2021 07:59:50 +0100 Subject: [PATCH] Fix SpecialPage alias test This was testing regex with completely unecessary long string. I believe it was meant to be the test message instead of being the haystack. Only the value of $alias may contain the slash, the rest of the string has no any other slash, this is already known. Also use simple string assertion instead of regex matching Change-Id: I47eb0bfcd510e4f1c92099a9cb53b584a34036ce --- .../integration/includes/language/SpecialPageAliasTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/integration/includes/language/SpecialPageAliasTest.php b/tests/phpunit/integration/includes/language/SpecialPageAliasTest.php index fff43408a03..07cb2758e89 100644 --- a/tests/phpunit/integration/includes/language/SpecialPageAliasTest.php +++ b/tests/phpunit/integration/includes/language/SpecialPageAliasTest.php @@ -20,8 +20,8 @@ class SpecialPageAliasTest extends MediaWikiIntegrationTestCase { public function testValidSpecialPageAliases( $code, $specialPageAliases ) { foreach ( $specialPageAliases as $specialPage => $aliases ) { foreach ( $aliases as $alias ) { - $msg = "$specialPage alias '$alias' in $code is valid with no slashes"; - $this->assertRegExp( '/^[^\/]*$/', $msg ); + $msg = "Special:$specialPage alias '$alias' in $code must not contain slashes"; + $this->assertStringNotContainsString( '/', $alias, $msg ); } } }