mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-12 00:04:11 +02:00
Added test to cover 100% + fixed fatal error
This commit is contained in:
committed by
Christian Gärtner
parent
a6964e4561
commit
bc175f0e12
@@ -359,7 +359,7 @@ class Stringy
|
||||
public function pad($length, $padStr = ' ', $padType = 'right')
|
||||
{
|
||||
if (!in_array($padType, array('left', 'right', 'both'))) {
|
||||
throw new InvalidArgumentException('Pad expects $padType ' .
|
||||
throw new \InvalidArgumentException('Pad expects $padType ' .
|
||||
"to be one of 'left', 'right' or 'both'");
|
||||
}
|
||||
|
||||
|
@@ -139,6 +139,14 @@ class StaticStringyTestCase extends CommonTest
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testPadException()
|
||||
{
|
||||
$result = S::pad('string', 5, 'foo', 'bar');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider stringsForPadLeft
|
||||
*/
|
||||
|
@@ -187,6 +187,15 @@ class StringyTestCase extends CommonTest
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testPadException()
|
||||
{
|
||||
$stringy = S::create('foo');
|
||||
$result = $stringy->pad(5, 'foo', 'bar');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider stringsForPadLeft
|
||||
*/
|
||||
|
Reference in New Issue
Block a user