mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-16 18:24:03 +02:00
Added $caseSensitive to count()
This commit is contained in:
@@ -907,7 +907,14 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
|
||||
array(0, '', 'fòô', 'UTF-8'),
|
||||
array(0, 'fòô', 'bàř', 'UTF-8'),
|
||||
array(1, 'fòô bàř', 'fòô', 'UTF-8'),
|
||||
array(2, 'fôòô bàř', 'ô', 'UTF-8')
|
||||
array(2, 'fôòô bàř', 'ô', 'UTF-8'),
|
||||
array(0, 'fÔÒÔ bàř', 'ô', 'UTF-8'),
|
||||
array(0, 'foo', 'BAR', false),
|
||||
array(1, 'foo bar', 'FOo', false),
|
||||
array(2, 'foo bar', 'O', false),
|
||||
array(1, 'fòô bàř', 'fÒÔ', false, 'UTF-8'),
|
||||
array(2, 'fôòô bàř', 'Ô', false, 'UTF-8'),
|
||||
array(2, 'συγγραφέας', 'Σ', false, 'UTF-8')
|
||||
);
|
||||
|
||||
return $testData;
|
||||
|
@@ -554,9 +554,10 @@ class StaticStringyTestCase extends CommonTest
|
||||
/**
|
||||
* @dataProvider stringsForCount
|
||||
*/
|
||||
public function testCount($expected, $str, $substring, $encoding = null)
|
||||
public function testCount($expected, $str, $substring, $caseSensitive = true,
|
||||
$encoding = null)
|
||||
{
|
||||
$result = S::count($str, $substring, $encoding);
|
||||
$result = S::count($str, $substring, $caseSensitive, $encoding);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
@@ -653,10 +653,11 @@ class StringyTestCase extends CommonTest
|
||||
/**
|
||||
* @dataProvider stringsForCount
|
||||
*/
|
||||
public function testCount($expected, $str, $substring, $encoding = null)
|
||||
public function testCount($expected, $str, $substring, $caseSensitive = true,
|
||||
$encoding = null)
|
||||
{
|
||||
$stringy = S::create($str, $encoding);
|
||||
$result = $stringy->count($substring);
|
||||
$result = $stringy->count($substring, $caseSensitive);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($str, $stringy);
|
||||
|
Reference in New Issue
Block a user