mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-12 08:14:06 +02:00
Add StaticStringy::hasUpperCase, StaticStringy::hasLowerCase, Stringy->hasUpperCase and Stringy->hasLowerCase along with tests.
This commit is contained in:
@@ -884,6 +884,24 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function hasLowerCaseProvider()
|
||||
{
|
||||
return array(
|
||||
array(false, ''),
|
||||
array(true, 'foobar'),
|
||||
array(false, 'FOO BAR'),
|
||||
array(true, 'fOO BAR'),
|
||||
array(true, 'foO BAR'),
|
||||
array(true, 'FOO BAr'),
|
||||
array(true, 'Foobar'),
|
||||
array(false, 'FÒÔBÀŘ', 'UTF-8'),
|
||||
array(true, 'fòôbàř', 'UTF-8'),
|
||||
array(true, 'fòôbàř2', 'UTF-8'),
|
||||
array(true, 'Fòô bàř', 'UTF-8'),
|
||||
array(true, 'fòôbÀŘ', 'UTF-8'),
|
||||
);
|
||||
}
|
||||
|
||||
public function isSerializedProvider()
|
||||
{
|
||||
return array(
|
||||
@@ -911,6 +929,24 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function hasUpperCaseProvider()
|
||||
{
|
||||
return array(
|
||||
array(false, ''),
|
||||
array(true, 'FOOBAR'),
|
||||
array(false, 'foo bar'),
|
||||
array(true, 'Foo bar'),
|
||||
array(true, 'FOo bar'),
|
||||
array(true, 'foo baR'),
|
||||
array(true, 'fOOBAR'),
|
||||
array(false, 'fòôbàř', 'UTF-8'),
|
||||
array(true, 'FÒÔBÀŘ', 'UTF-8'),
|
||||
array(true, 'FÒÔBÀŘ2', 'UTF-8'),
|
||||
array(true, 'fÒÔ BÀŘ', 'UTF-8'),
|
||||
array(true, 'FÒÔBàř', 'UTF-8'),
|
||||
);
|
||||
}
|
||||
|
||||
public function isHexadecimalProvider()
|
||||
{
|
||||
return array(
|
||||
|
@@ -565,6 +565,16 @@ class StaticStringyTestCase extends CommonTest
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider hasLowerCaseProvider()
|
||||
*/
|
||||
public function testHasLowerCase($expected, $str, $encoding = null)
|
||||
{
|
||||
$result = S::hasLowerCase($str, $encoding);
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider isSerializedProvider()
|
||||
*/
|
||||
@@ -585,6 +595,16 @@ class StaticStringyTestCase extends CommonTest
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider hasUpperCaseProvider()
|
||||
*/
|
||||
public function testHasUpperCase($expected, $str, $encoding = null)
|
||||
{
|
||||
$result = S::hasUpperCase($str, $encoding);
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider isHexadecimalProvider()
|
||||
*/
|
||||
|
@@ -813,6 +813,18 @@ class StringyTestCase extends CommonTest
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider hasLowerCaseProvider()
|
||||
*/
|
||||
public function testHasLowerCase($expected, $str, $encoding = null)
|
||||
{
|
||||
$stringy = S::create($str, $encoding);
|
||||
$result = $stringy->hasLowerCase();
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider isSerializedProvider()
|
||||
*/
|
||||
@@ -837,6 +849,18 @@ class StringyTestCase extends CommonTest
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider hasUpperCaseProvider()
|
||||
*/
|
||||
public function testHasUpperCase($expected, $str, $encoding = null)
|
||||
{
|
||||
$stringy = S::create($str, $encoding);
|
||||
$result = $stringy->hasUpperCase();
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider isHexadecimalProvider()
|
||||
*/
|
||||
|
Reference in New Issue
Block a user