1
0
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:
ChristianGaertner
2013-09-03 23:17:51 +02:00
committed by Christian Gärtner
parent a6964e4561
commit bc175f0e12
3 changed files with 18 additions and 1 deletions

View File

@@ -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'");
}

View File

@@ -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
*/

View File

@@ -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
*/