From bbe4c659aa6d005566cd37e906d62f689b709e3d Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 29 Nov 2013 21:57:08 -0500 Subject: [PATCH] Add tests for TextHelper::autoLink() Add tests for email addresses embedded in urls. Refs #2403 --- .../Test/Case/View/Helper/TextHelperTest.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php index ea5a07e4c9b..6b5d86621c3 100644 --- a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php @@ -142,7 +142,27 @@ public function testAutoLink() { $expected = 'This is a test text with URL http://www.cakephp.org(and some more text)'; $result = $this->Text->autoLink($text); $this->assertEquals($expected, $result); + } + +/** + * Test mixing URLs and Email addresses in one confusing string. + * + * @return void + */ + public function testAutoLinkMixed() { + $text = 'Text with a url/email http://example.com/store?email=mark@example.com and email.'; + $expected = 'Text with a url/email ' . + 'http://example.com/store?email=mark@example.com and email.'; + $result = $this->Text->autoLink($text); + $this->assertEquals($expected, $result); + } +/** + * test autoLink() and options. + * + * @return void + */ + public function testAutoLinkOptions() { $text = 'This is a test text with URL http://www.cakephp.org'; $expected = 'This is a test text with URL http://www.cakephp.org'; $result = $this->Text->autoLink($text, array('class' => 'link')); @@ -246,7 +266,7 @@ public static function autoLinkProvider() { array( 'Text with a partial http://www.küchenschöhn-not-working.de URL', 'Text with a partial http://www.küchenschöhn-not-working.de URL' - ) + ), ); }