Browse Source

Fixed incorrect unit test and fixed mistake in Regex

Sevvlor 8 years ago
parent
commit
096494c040
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/View/Helper/TextHelper.php
  2. 1 1
      tests/TestCase/View/Helper/TextHelperTest.php

+ 1 - 1
src/View/Helper/TextHelper.php

@@ -123,7 +123,7 @@ class TextHelper extends Helper
                     (?<left>[\[<(]) # left paren,brace
                     (?>
                         # Lax match URL
-                        (?<url>(?:https?|ftp|nntp):\/\/[\p{L}0-9.\-_:]+(?:[\/?][\p{L}0-9.\-_:\/?=&>\[\()#@\+~!;,%]+[^-_:?=&>\[\()#@\+~!;,.%\s])?)
+                        (?<url>(?:https?|ftp|nntp):\/\/[\p{L}0-9.\-_:]+(?:[\/?][\p{L}0-9.\-_:\/?=&>\[\]\(\#@\+~!;,%]+[^-_:?>\[\]\(\#@\+~!;<,.%\s])?)
                         (?<right>[\])>]) # right paren,brace
                     )
                 )

+ 1 - 1
tests/TestCase/View/Helper/TextHelperTest.php

@@ -382,7 +382,7 @@ class TextHelperTest extends TestCase
                 'This is text,<a href="https://fakedomain.ext/path/#!topic/test,tag">https://fakedomain.ext/path/#!topic/test,tag</a>, with a comma'
             ],
             [
-                'This is text,https://fakedomain.ext/path/#!topic/test,tag, with a comma',
+                'This is text https://fakedomain.ext/path/#!topic/path!',
                 'This is text <a href="https://fakedomain.ext/path/#!topic/path">https://fakedomain.ext/path/#!topic/path</a>!'
             ]
         ];