LocalisationCache: try harder to use LCStoreCDB
[lhc/web/wiklou.git] / tests / phpunit / includes / LinkFilterTest.php
index 41207b7..9093564 100644 (file)
@@ -34,7 +34,7 @@ class LinkFilterTest extends MediaWikiLangTestCase {
         *
         * Takes an array as created by LinkFilter::makeLikeArray() and creates a regex from it
         *
-        * @param Array $like Array as created by LinkFilter::makeLikeArray()
+        * @param array $like Array as created by LinkFilter::makeLikeArray()
         * @return string Regex
         */
        function createRegexFromLIKE( $like ) {
@@ -76,7 +76,7 @@ class LinkFilterTest extends MediaWikiLangTestCase {
                        array( 'https://', '*.com', 'https://name:pass@secure.com/index.html' ),
                        array( 'http://', 'name:pass@test.com', 'http://test.com' ),
                        array( 'http://', 'test.com', 'http://name:pass@test.com' ),
-                       array( 'http://', '*.test.com', 'http://a.b.c.test.com/dir/dir/file?a=6'),
+                       array( 'http://', '*.test.com', 'http://a.b.c.test.com/dir/dir/file?a=6' ),
                        array( null, 'http://*.test.com', 'http://www.test.com' ),
                        array( 'mailto:', 'name@mail.test123.com', 'mailto:name@mail.test123.com' ),
                        array( '',
@@ -122,24 +122,19 @@ class LinkFilterTest extends MediaWikiLangTestCase {
                        array( '', 'git://github.com/prwef/abc-def.git', 'git://github.com/prwef/abc-def.git' ),
                        array( 'git://', 'github.com/', 'git://github.com/prwef/abc-def.git' ),
                        array( 'git://', '*.github.com/', 'git://a.b.c.d.e.f.github.com/prwef/abc-def.git' ),
-                       array( '', 'gopher://*.test.com/', 'gopher://gopher.test.com/0/v2/vstat'),
-                       array( 'telnet://', '*.test.com', 'telnet://shell.test.com/~home/'),
+                       array( '', 'gopher://*.test.com/', 'gopher://gopher.test.com/0/v2/vstat' ),
+                       array( 'telnet://', '*.test.com', 'telnet://shell.test.com/~home/' ),
 
-                       //
                        // The following only work in PHP >= 5.3.7, due to a bug in parse_url which eats
                        // the path from the url (https://bugs.php.net/bug.php?id=54180)
-                       //
                        // array( '', 'http://test.com', 'http://test.com/index?arg=1' ),
                        // array( 'http://', '*.test.com', 'http://www.test.com/index?arg=1' ),
                        // array( '' ,
                        //    'http://xx23124:__ffdfdef__@www.test.com:12345/dir' ,
                        //    'http://name:pass@www.test.com:12345/dir/dir/file.xyz.php#__se__?arg1=_&arg2[]=4rtg'
                        // ),
-                       //
 
-                       //
                        // Tests for false positives
-                       //
                        array( 'http://', 'test.com', 'http://www.test.com', false ),
                        array( 'http://', 'www1.test.com', 'http://www.test.com', false ),
                        array( 'http://', '*.test.com', 'http://www.test.t.com', false ),
@@ -166,13 +161,11 @@ class LinkFilterTest extends MediaWikiLangTestCase {
                        array( '', 'http://test.com:8080/dir/', 'http://test.com:808/dir/', false ),
                        array( '', 'http://test.com/dir/index.html', 'http://test.com/dir/index.php', false ),
 
-                       //
                        // These are false positives too and ideally shouldn't match, but that
                        // would require using regexes and RLIKE instead of LIKE
-                       //
                        // array( null, 'http://*.test.com', 'http://www.test.com:80', false ),
                        // array( '', 'https://*.wikimedia.org/r/#/q/status:open,n,z',
-                       //      'https://gerrit.wikimedia.org/XXX/r/#/q/status:open,n,z', false ),
+                       //      'https://gerrit.wikimedia.org/XXX/r/#/q/status:open,n,z', false ),
                );
 
        }
@@ -185,9 +178,9 @@ class LinkFilterTest extends MediaWikiLangTestCase {
         *
         * @dataProvider provideValidPatterns
         *
-        * @param String $protocol Protocol, e.g. 'http://' or 'mailto:'
-        * @param String $pattern Search pattern to feed to LinkFilter::makeLikeArray
-        * @param String $url URL to feed to wfMakeUrlIndexes
+        * @param string $protocol Protocol, e.g. 'http://' or 'mailto:'
+        * @param string $pattern Search pattern to feed to LinkFilter::makeLikeArray
+        * @param string $url URL to feed to wfMakeUrlIndexes
         * @param bool $shouldBeFound Should the URL be found? (defaults true)
         */
        function testMakeLikeArrayWithValidPatterns( $protocol, $pattern, $url, $shouldBeFound = true ) {
@@ -243,10 +236,10 @@ class LinkFilterTest extends MediaWikiLangTestCase {
                        array( 'http://*.test.*' ),
                        array( 'http://*test.com' ),
                        array( 'https://*' ),
-                       array( '*://test.com'),
+                       array( '*://test.com' ),
                        array( 'mailto:name:pass@t*est.com' ),
-                       array( 'http://*:888/'),
-                       array( '*http://'),
+                       array( 'http://*:888/' ),
+                       array( '*http://' ),
                        array( 'test.com/*/index' ),
                        array( 'test.com/dir/index?arg=*' ),
                );
@@ -260,7 +253,7 @@ class LinkFilterTest extends MediaWikiLangTestCase {
         *
         * @dataProvider provideInvalidPatterns
         *
-        * @param $pattern string: Invalid search pattern
+        * @param string $pattern Invalid search pattern
         */
        function testMakeLikeArrayWithInvalidPatterns( $pattern ) {