From 02cc436ec7cf0cfca5fc9b5166cc537bbee53671 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 30 Jul 2012 18:51:44 -0700 Subject: Added urlify to try and create webbie auto-suggestions out of whatever unicode stuff gets thrown in as a name. Currently this will only work for latin/european/cyrillic/russian, but possible to extend to ideographic forms. --- library/urlify/tests/URLifyTest.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 library/urlify/tests/URLifyTest.php (limited to 'library/urlify/tests/URLifyTest.php') diff --git a/library/urlify/tests/URLifyTest.php b/library/urlify/tests/URLifyTest.php new file mode 100644 index 000000000..26ecb5dea --- /dev/null +++ b/library/urlify/tests/URLifyTest.php @@ -0,0 +1,31 @@ +assertEquals (' J\'etudie le francais ', URLify::downcode (' J\'étudie le français ')); + $this->assertEquals ('Lo siento, no hablo espanol.', URLify::downcode ('Lo siento, no hablo español.')); + $this->assertEquals ('F3PWS', URLify::downcode ('ΦΞΠΏΣ')); + } + + function test_filter () { + $this->assertEquals ('jetudie-le-francais', URLify::filter (' J\'étudie le français ')); + $this->assertEquals ('lo-siento-no-hablo-espanol', URLify::filter ('Lo siento, no hablo español.')); + $this->assertEquals ('f3pws', URLify::filter ('ΦΞΠΏΣ')); + } + + function test_add_chars () { + $this->assertEquals ('¿ ® ¼ ¼ ¾ ¶', URLify::downcode ('¿ ® ¼ ¼ ¾ ¶')); + URLify::add_chars (array ( + '¿' => '?', '®' => '(r)', '¼' => '1/4', + '¼' => '1/2', '¾' => '3/4', '¶' => 'P' + )); + $this->assertEquals ('? (r) 1/2 1/2 3/4 P', URLify::downcode ('¿ ® ¼ ¼ ¾ ¶')); + } + + function test_remove_words () { + $this->assertEquals ('foo-bar', URLify::filter ('foo bar')); + URLify::remove_words (array ('foo', 'bar')); + $this->assertEquals ('', URLify::filter ('foo bar')); + } +} + +?> -- cgit v1.2.3