mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-08 22:36:32 +02:00
Add append and prepend
This commit is contained in:
@@ -201,6 +201,42 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider appendProvider()
|
||||
*/
|
||||
public function testAppend($expected, $str, $string, $encoding = null)
|
||||
{
|
||||
$result = S::create($str, $encoding)->append($string);
|
||||
$this->assertStringy($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function appendProvider()
|
||||
{
|
||||
return array(
|
||||
array('foobar', 'foo', 'bar'),
|
||||
array('fòôbàř', 'fòô', 'bàř', 'UTF-8')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider prependProvider()
|
||||
*/
|
||||
public function testPrepend($expected, $str, $string, $encoding = null)
|
||||
{
|
||||
$result = S::create($str, $encoding)->prepend($string);
|
||||
$this->assertStringy($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function prependProvider()
|
||||
{
|
||||
return array(
|
||||
array('foobar', 'bar', 'foo'),
|
||||
array('fòôbàř', 'bàř', 'fòô', 'UTF-8')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider charsProvider()
|
||||
*/
|
||||
|
Reference in New Issue
Block a user