1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-08 14:26:36 +02:00

Add trimLeft, trimRight, support unicode whitespace

This commit is contained in:
Daniel St. Jules
2015-07-22 13:55:21 -07:00
parent 7763df3c3b
commit fe3368bd8b
6 changed files with 194 additions and 74 deletions

View File

@@ -400,11 +400,33 @@ class StaticStringyTestCase extends CommonTest
}
/**
* @dataProvider trimProviderWithoutParams()
* @dataProvider trimProvider()
*/
public function testTrim($expected, $str)
public function testTrim($expected, $str, $chars = null, $encoding = null)
{
$result = S::trim($str);
$result = S::trim($str, $chars, $encoding);
$this->assertInternalType('string', $result);
$this->assertEquals($expected, $result);
}
/**
* @dataProvider trimLeftProvider()
*/
public function testTrimLeft($expected, $str, $chars = null,
$encoding = null)
{
$result = S::trimLeft($str, $chars, $encoding);
$this->assertInternalType('string', $result);
$this->assertEquals($expected, $result);
}
/**
* @dataProvider trimRightProvider()
*/
public function testTrimRight($expected, $str, $chars = null,
$encoding = null)
{
$result = S::trimRight($str, $chars, $encoding);
$this->assertInternalType('string', $result);
$this->assertEquals($expected, $result);
}