mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-30 00:10:18 +02:00
Cleanup and merge branch 'isserialized'
This commit is contained in:
@@ -782,6 +782,21 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
|
||||
return $testData;
|
||||
}
|
||||
|
||||
public function stringsForIsSerialized()
|
||||
{
|
||||
$testData = array(
|
||||
array(false, ''),
|
||||
array(true, 'a:1:{s:3:"foo";s:3:"bar";}'),
|
||||
array(false, 'a:1:{s:3:"foo";s:3:"bar"}'),
|
||||
array(true, serialize(array('foo' => 'bar'))),
|
||||
array(true, 'a:1:{s:5:"fòô";s:5:"bàř";}', 'UTF-8'),
|
||||
array(false, 'a:1:{s:5:"fòô";s:5:"bàř"}', 'UTF-8'),
|
||||
array(true, serialize(array('fòô' => 'bár')), 'UTF-8'),
|
||||
);
|
||||
|
||||
return $testData;
|
||||
}
|
||||
|
||||
public function stringsForIsUpperCase()
|
||||
{
|
||||
$testData = array(
|
||||
|
@@ -482,6 +482,16 @@ class StaticStringyTestCase extends CommonTest
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider stringsForIsSerialized
|
||||
*/
|
||||
public function testIsSerialized($expected, $str, $encoding = null)
|
||||
{
|
||||
$result = S::isSerialized($str, $encoding);
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider stringsForIsUpperCase
|
||||
*/
|
||||
|
@@ -568,6 +568,18 @@ class StringyTestCase extends CommonTest
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider stringsForIsSerialized
|
||||
*/
|
||||
public function testIsSerialized($expected, $str, $encoding = null)
|
||||
{
|
||||
$stringy = S::create($str, $encoding);
|
||||
$result = $stringy->isSerialized();
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($str, $stringy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider stringsForIsUpperCase
|
||||
*/
|
||||
|
Reference in New Issue
Block a user