1
0
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:
Glynn Forrest
2013-11-26 14:11:41 +00:00
parent d4baab7583
commit 906f217dc1
5 changed files with 19 additions and 13 deletions

View File

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

View File

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

View File

@@ -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);