1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-20 03:51:21 +02:00

Add slugify

This commit is contained in:
Daniel St. Jules
2013-07-21 23:07:31 -04:00
parent 031e9e68b2
commit feb4c5a36d
3 changed files with 52 additions and 6 deletions

View File

@@ -485,6 +485,27 @@ class StringyTestCase extends PHPUnit_Framework_TestCase {
return $testData;
}
/**
* @dataProvider stringsForSlugify
*/
public function testSlugify($expected, $string) {
$result = S::slugify($string);
$this->assertEquals($expected, $result);
}
public function stringsForSlugify() {
$testData = array(
array('foo-bar', ' foo bar '),
array('foo-dbar', " Foo d'Bar "),
array('a-string-with-dashes', 'A string-with-dashes'),
array('using-strings-like-foo-bar', 'Using strings like fòô bàř'),
array('unrecognized-chars-like', 'unrecognized chars like συγγρ'),
array('numbers-1234', 'numbers 1234')
);
return $testData;
}
}
?>