You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/Cake/Test/Case/View/Helper/TextHelperTest.php
+69-58Lines changed: 69 additions & 58 deletions
Original file line number
Diff line number
Diff line change
@@ -165,81 +165,92 @@ public function testAutoLinkEscape() {
165
165
$this->assertEquals($expected, $result);
166
166
}
167
167
168
+
/**
169
+
* Data provider for autoLinking
170
+
*/
171
+
publicstaticfunctionautoLinkProvider() {
172
+
returnarray(
173
+
array(
174
+
'This is a test text',
175
+
'This is a test text',
176
+
),
177
+
array(
178
+
'This is a test that includes (www.cakephp.org)',
179
+
'This is a test that includes (<a href="http://www.cakephp.org">www.cakephp.org</a>)',
180
+
),
181
+
array(
182
+
'This is a test that includes www.cakephp.org:8080',
183
+
'This is a test that includes <a href="http://www.cakephp.org:8080">www.cakephp.org:8080</a>',
184
+
),
185
+
array(
186
+
'This is a test that includes http://de.wikipedia.org/wiki/Kanton_(Schweiz)#fragment',
187
+
'This is a test that includes <a href="http://de.wikipedia.org/wiki/Kanton_(Schweiz)#fragment">http://de.wikipedia.org/wiki/Kanton_(Schweiz)#fragment</a>',
188
+
),
189
+
array(
190
+
'This is a test that includes www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment',
191
+
'This is a test that includes <a href="http://www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment">www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment</a>',
192
+
),
193
+
array(
194
+
'This is a test that includes http://example.com/test.php?foo=bar text',
195
+
'This is a test that includes <a href="http://example.com/test.php?foo=bar">http://example.com/test.php?foo=bar</a> text',
196
+
),
197
+
array(
198
+
'This is a test that includes www.example.com/test.php?foo=bar text',
199
+
'This is a test that includes <a href="http://www.example.com/test.php?foo=bar">www.example.com/test.php?foo=bar</a> text',
200
+
),
201
+
array(
202
+
'Text with a partial www.cakephp.org URL',
203
+
'Text with a partial <a href="http://www.cakephp.org">www.cakephp.org</a> URL',
204
+
),
205
+
array(
206
+
'Text with a partial WWW.cakephp.org URL',
207
+
'Text with a partial <a href="http://WWW.cakephp.org">WWW.cakephp.org</a> URL',
$text = 'This is a test that includes http://de.wikipedia.org/wiki/Kanton_(Schweiz)#fragment';
190
-
$expected = 'This is a test that includes <a href="http://de.wikipedia.org/wiki/Kanton_(Schweiz)#fragment">http://de.wikipedia.org/wiki/Kanton_(Schweiz)#fragment</a>';
191
-
$result = $this->Text->autoLinkUrls($text);
192
-
$this->assertEquals($expected, $result);
193
-
194
-
$text = 'This is a test that includes www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment';
195
-
$expected = 'This is a test that includes <a href="http://www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment">www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment</a>';
196
-
$result = $this->Text->autoLinkUrls($text);
197
-
$this->assertEquals($expected, $result);
198
-
199
-
$text = 'This is a test that includes http://example.com/test.php?foo=bar text';
200
-
$expected = 'This is a test that includes <a href="http://example.com/test.php?foo=bar">http://example.com/test.php?foo=bar</a> text';
201
-
$result = $this->Text->autoLinkUrls($text);
202
-
$this->assertEquals($expected, $result);
203
-
204
-
$text = 'This is a test that includes www.example.com/test.php?foo=bar text';
205
-
$expected = 'This is a test that includes <a href="http://www.example.com/test.php?foo=bar">www.example.com/test.php?foo=bar</a> text';
206
-
$result = $this->Text->autoLinkUrls($text);
207
-
$this->assertEquals($expected, $result);
208
-
209
-
$text = 'Text with a partial www.cakephp.org URL';
210
-
$expected = 'Text with a partial <a href="http://www.cakephp.org"\s*>www.cakephp.org</a> URL';
0 commit comments