1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-28 15:29:58 +02:00

Add humanize and tidy

This commit is contained in:
Daniel St. Jules
2013-07-12 19:35:28 -04:00
parent ff7e907b9b
commit b632268623
3 changed files with 102 additions and 11 deletions

View File

@@ -210,6 +210,43 @@ class StringyTestCase extends PHPUnit_Framework_TestCase {
return $testData;
}
/**
* @dataProvider stringsForHumanize
*/
public function testHumanize($string, $expected, $encoding = null) {
$result = S::humanize($string, $encoding);
$this->assertEquals($expected, $result);
}
public function stringsForHumanize() {
$testData = array(
array('author_id', 'Author'),
array(' _test_user_', 'Test user'),
array(' συγγραφέας_id ', 'Συγγραφέας', 'UTF-8')
);
return $testData;
}
/**
* @dataProvider stringsForTidy
*/
public function testTidy($string, $expected) {
$result = S::tidy($string);
$this->assertEquals($expected, $result);
}
public function stringsForTidy() {
$testData = array(
array('“I see…”', '"I see..."'),
array("This too", "'This too'"),
array('test—dash', 'test-dash'),
array('Ο συγγραφέας είπε…', 'Ο συγγραφέας είπε...')
);
return $testData;
}
}
?>