mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-16 10:14:05 +02:00
Adding optional $replacement parameter to slugify.
This commit is contained in:
@@ -330,7 +330,9 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
|
||||
array('unrecognized-chars-like', 'unrecognized chars like συγγρ'),
|
||||
array('numbers-1234', 'numbers 1234'),
|
||||
array('perevirka-ryadka', 'перевірка рядка'),
|
||||
array('bukvar-s-bukvoy-y', 'букварь с буквой ы')
|
||||
array('bukvar-s-bukvoy-y', 'букварь с буквой ы'),
|
||||
array('foo:bar:baz', 'Foo bar baz', ':'),
|
||||
array('a_string_with_underscores', 'A_string with_underscores', '_')
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -245,9 +245,9 @@ class StaticStringyTestCase extends CommonTest
|
||||
/**
|
||||
* @dataProvider slugifyProvider()
|
||||
*/
|
||||
public function testSlugify($expected, $str)
|
||||
public function testSlugify($expected, $str, $replacement = '-')
|
||||
{
|
||||
$result = S::slugify($str);
|
||||
$result = S::slugify($str, $replacement);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
@@ -312,10 +312,10 @@ class StringyTestCase extends CommonTest
|
||||
/**
|
||||
* @dataProvider slugifyProvider()
|
||||
*/
|
||||
public function testSlugify($expected, $str)
|
||||
public function testSlugify($expected, $str, $replacement = '-')
|
||||
{
|
||||
$stringy = S::create($str);
|
||||
$result = $stringy->slugify();
|
||||
$result = $stringy->slugify($replacement);
|
||||
$this->assertInstanceOf('Stringy\Stringy', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($str, $stringy);
|
||||
|
Reference in New Issue
Block a user