1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

e107::unserialize() test. Needs more examples.

This commit is contained in:
Cameron
2019-05-13 13:52:21 -07:00
parent 843fed12dd
commit 31555da340

View File

@@ -29,9 +29,14 @@
private function getSitePrefExample() private function getSitePrefExample()
{ {
$data = ""; $data = '
$data = array (
\'email_password\' => \'$2y$10$IpizFx.gp5USl98SLXwwbeod3SYF3M3raAQX0y01ETexzoutvdyWW\',
);
';
return $data;
return (string) $data;
} }
@@ -65,6 +70,10 @@
// var_export format test without slashes ---- // var_export format test without slashes ----
$string_3 = "array('var_export' => 'some value',)"; $string_3 = "array('var_export' => 'some value',)";
$actual = $this->arrObj->unserialize($string_3); $actual = $this->arrObj->unserialize($string_3);
$this->assertArrayHasKey('var_export', $actual); $this->assertArrayHasKey('var_export', $actual);
@@ -95,9 +104,24 @@
define('e_DEBUG', true); define('e_DEBUG', true);
// case sitePrefs // case sitePrefs
$string_6 = $this->getSitePrefExample(); // $string_6 = $this->getSitePrefExample();
$actual = $this->arrObj->unserialize($string_6); // $actual = $this->arrObj->unserialize($string_6);
$tests = array(
0 => array('string' => $this->getSitePrefExample(),
'expected' => array('email_password' => '$2y$10$IpizFx.gp5USl98SLXwwbeod3SYF3M3raAQX0y01ETexzoutvdyWW' )
),
);
foreach($tests as $var)
{
$result = $this->arrObj->unserialize($var['string']);
$this->assertEquals($var['expected'], $result);
}
// var_dump($actual); // var_dump($actual);
} }