X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FLinkFilterTest.php;h=428b0129a0d9e3bbb877cc5bbcdeceb685e366f8;hb=36915a096320d243e2253e18f74845ad9e235e0a;hp=61b165a4dce74d6012329f9247b92f1bf133d033;hpb=601519ee36462faabacf4547c9aefaf7e8726476;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/LinkFilterTest.php b/tests/phpunit/includes/LinkFilterTest.php index 61b165a4dc..428b0129a0 100644 --- a/tests/phpunit/includes/LinkFilterTest.php +++ b/tests/phpunit/includes/LinkFilterTest.php @@ -6,7 +6,6 @@ class LinkFilterTest extends MediaWikiLangTestCase { protected function setUp() { - parent::setUp(); $this->setMwGlobals( 'wgUrlProtocols', [ @@ -26,7 +25,6 @@ class LinkFilterTest extends MediaWikiLangTestCase { 'mms://', '//', ] ); - } /** @@ -38,11 +36,9 @@ class LinkFilterTest extends MediaWikiLangTestCase { * @return string Regex */ function createRegexFromLIKE( $like ) { - $regex = '!^'; foreach ( $like as $item ) { - if ( $item instanceof LikeMatch ) { if ( $item->toString() == '%' ) { $regex .= '.*'; @@ -58,7 +54,6 @@ class LinkFilterTest extends MediaWikiLangTestCase { $regex .= '$!'; return $regex; - } /** @@ -67,7 +62,6 @@ class LinkFilterTest extends MediaWikiLangTestCase { * @return array */ public static function provideValidPatterns() { - return [ // Protocol, Search pattern, URL which matches the pattern [ 'http://', '*.test.com', 'http://www.test.com' ], @@ -164,7 +158,6 @@ class LinkFilterTest extends MediaWikiLangTestCase { // [ '', 'https://*.wikimedia.org/r/#/q/status:open,n,z', // 'https://gerrit.wikimedia.org/XXX/r/#/q/status:open,n,z', false ], ]; - } /** @@ -181,7 +174,6 @@ class LinkFilterTest extends MediaWikiLangTestCase { * @param bool $shouldBeFound Should the URL be found? (defaults true) */ function testMakeLikeArrayWithValidPatterns( $protocol, $pattern, $url, $shouldBeFound = true ) { - $indexes = wfMakeUrlIndexes( $url ); $likeArray = LinkFilter::makeLikeArray( $pattern, $protocol ); @@ -211,7 +203,6 @@ class LinkFilterTest extends MediaWikiLangTestCase { "Search pattern '$protocol$pattern' should not find url '$url' \n$debugmsg" ); } - } /** @@ -220,7 +211,6 @@ class LinkFilterTest extends MediaWikiLangTestCase { * @return array */ public static function provideInvalidPatterns() { - return [ [ '' ], [ '*' ], @@ -240,7 +230,6 @@ class LinkFilterTest extends MediaWikiLangTestCase { [ 'test.com/*/index' ], [ 'test.com/dir/index?arg=*' ], ]; - } /** @@ -253,12 +242,10 @@ class LinkFilterTest extends MediaWikiLangTestCase { * @param string $pattern Invalid search pattern */ function testMakeLikeArrayWithInvalidPatterns( $pattern ) { - $this->assertFalse( LinkFilter::makeLikeArray( $pattern ), "'$pattern' is not a valid pattern and should be rejected" ); - } }