aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/UtilsTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/UtilsTest.php')
-rw-r--r--tests/UtilsTest.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php
index 4847ea94..02eecda2 100644
--- a/tests/UtilsTest.php
+++ b/tests/UtilsTest.php
@@ -187,4 +187,41 @@ class UtilsTest extends PHPUnit_Framework_TestCase
187 is_session_id_valid('c0ZqcWF3VFE2NmJBdm1HMVQ0ZHJ3UmZPbTFsNGhkNHI=') 187 is_session_id_valid('c0ZqcWF3VFE2NmJBdm1HMVQ0ZHJ3UmZPbTFsNGhkNHI=')
188 ); 188 );
189 } 189 }
190
191 /**
192 * Test text2clickable without a redirector being set.
193 */
194 public function testText2clickableWithoutRedirector()
195 {
196 $text = 'stuff http://hello.there/is=someone#here otherstuff';
197 $expectedText = 'stuff <a href="http://hello.there/is=someone#here">http://hello.there/is=someone#here</a> otherstuff';
198 $processedText = text2clickable($text, '');
199 $this->assertEquals($expectedText, $processedText);
200 }
201
202 /**
203 * Test text2clickable a redirector set.
204 */
205 public function testText2clickableWithRedirector()
206 {
207 $text = 'stuff http://hello.there/is=someone#here otherstuff';
208 $redirector = 'http://redirector.to';
209 $expectedText = 'stuff <a href="'.
210 $redirector .
211 urlencode('http://hello.there/is=someone#here') .
212 '">http://hello.there/is=someone#here</a> otherstuff';
213 $processedText = text2clickable($text, $redirector);
214 $this->assertEquals($expectedText, $processedText);
215 }
216
217 /**
218 * Test testSpace2nbsp.
219 */
220 public function testSpace2nbsp()
221 {
222 $text = ' Are you thrilled by flags ?'. PHP_EOL .' Really?';
223 $expectedText = '&nbsp; Are you &nbsp; thrilled &nbsp;by flags &nbsp; ?'. PHP_EOL .'&nbsp;Really?';
224 $processedText = space2nbsp($text);
225 $this->assertEquals($expectedText, $processedText);
226 }
190} 227}