diff options
author | Cash Costello <cash.costello@gmail.com> | 2012-07-05 17:12:19 -0700 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2012-07-05 17:12:19 -0700 |
commit | 35bd23ec8deb6c1f576780169bd0808caae4bdd1 (patch) | |
tree | d0c1f73dabf08333cd10e6a2d9384a39b40c36ba /engine/tests/regression/trac_bugs.php | |
parent | 34576a1f81d50a44064567469eb1406a028c92a7 (diff) | |
parent | 8a5ddacfa2598b8d984c2cdc6142d41936f38c48 (diff) | |
download | elgg-35bd23ec8deb6c1f576780169bd0808caae4bdd1.tar.gz elgg-35bd23ec8deb6c1f576780169bd0808caae4bdd1.tar.bz2 |
Merge pull request #281 from mrclay/2276-friendly-title
Fixes #2276: Better friendly titles
Diffstat (limited to 'engine/tests/regression/trac_bugs.php')
-rw-r--r-- | engine/tests/regression/trac_bugs.php | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php index 26a45ab6a..691433a41 100644 --- a/engine/tests/regression/trac_bugs.php +++ b/engine/tests/regression/trac_bugs.php @@ -202,16 +202,33 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest { /** * http://trac.elgg.org/ticket/3210 - Don't remove -s in friendly titles - * @todo: http://trac.elgg.org/ticket/2276 - improve char encoding + * http://trac.elgg.org/ticket/2276 - improve char encoding */ public function test_friendly_title() { $cases = array( - 'Simple Test' => 'simple-test', - 'Test top-level page' => 'test-top-level-page', -// 'éclair' => 'éclair', -// 'English, Español, and 日本語' => 'english-español-and-日本語' + // hyphen, underscore and ASCII whitespace replaced by separator, + // other non-alphanumeric ASCII removed + "a-a_a a\na\ra\ta\va!a\"a#a\$a%a&a'a(a)a*a+a,a.a/a:a;a<a=a>a?a@a[a\\a]a^a`a{a|a}a~a" + => "a-a-a-a-a-a-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + + // separators trimmed + "-_ hello _-" => "hello", + + // accents removed, lower case, other multibyte chars are URL encoded + "I\xC3\xB1t\xC3\xABrn\xC3\xA2ti\xC3\xB4n\xC3\xA0liz\xC3\xA6ti\xC3\xB8n, AND \xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E" + // Iñtërnâtiônàlizætiøn, AND 日本語 + => 'internationalizaetion-and-%E6%97%A5%E6%9C%AC%E8%AA%9E', + + // some HTML entity replacements + "Me & You" => 'me-and-you', ); + // where available, string is converted to NFC before transliteration + if (ElggTranslit::hasNormalizerSupport()) { + $form_d = "A\xCC\x8A"; // A followed by 'COMBINING RING ABOVE' (U+030A) + $cases[$form_d] = "a"; + } + foreach ($cases as $case => $expected) { $friendly_title = elgg_get_friendly_title($case); $this->assertIdentical($expected, $friendly_title); |