From 7c37b4ba6fdfbcf5337b52ec64c9d9a8d0ad43d8 Mon Sep 17 00:00:00 2001 From: Achim Ennenbach Date: Fri, 10 Aug 2018 21:39:38 +0200 Subject: [PATCH] added tests for eHelper::title2sef() The tests are based on my PR e107inc/e107#3370 --- tests/unit/eHelperTest.php | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/unit/eHelperTest.php b/tests/unit/eHelperTest.php index 33fe024e7..aefb54ea5 100644 --- a/tests/unit/eHelperTest.php +++ b/tests/unit/eHelperTest.php @@ -58,12 +58,40 @@ { } - - public function testTitle2sef() +*/ + public function testTitle2sefFromPlainText() { + $actual = $this->hp->title2sef('Plain text test'); + $expected = 'plain-text-test'; + $this->assertEquals($expected, $actual); } + public function testTitle2sefFromPlainTextStripSpecialChars() + { + $actual = $this->hp->title2sef('Plain text test with special chars !()+*+#"\'\\'); + $expected = 'plain-text-test-with-special-chars'; + + $this->assertEquals($expected, $actual); + } + + public function testTitle2sefFromBbcodeText() + { + $actual = $this->hp->title2sef('BBCode [b]text[/b] test [img]logo.png[/img]'); + $expected = 'bbcode-text-test'; + + $this->assertEquals($expected, $actual); + } + + public function testTitle2sefFromHtmlText() + { + $actual = $this->hp->title2sef('HTML text test '); + $expected = 'html-text-test'; + + $this->assertEquals($expected, $actual); + } + +/* public function testCamelize() {