1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-10 23:34:00 +02:00

Updated pad methods

This commit is contained in:
Daniel St. Jules
2014-03-18 23:56:37 -04:00
parent f0805f522d
commit e46797a9f8
5 changed files with 128 additions and 26 deletions

View File

@@ -309,6 +309,28 @@ class StringyTestCase extends CommonTest
$this->assertEquals($str, $stringy);
}
/**
* @dataProvider padProvider()
*/
public function testPad($expected, $str, $length, $padStr = ' ',
$padType = 'right', $encoding = null)
{
$stringy = S::create($str, $encoding);
$result = $stringy->pad($length, $padStr, $padType);
$this->assertInstanceOf('Stringy\Stringy', $result);
$this->assertEquals($expected, $result);
$this->assertEquals($str, $stringy);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testPadException()
{
$stringy = S::create('foo');
$result = $stringy->pad(5, 'foo', 'bar');
}
/**
* @dataProvider padLeftProvider()
*/