diff --git a/src/utils/__tests__/PhutilUtilsTestCase.php b/src/utils/__tests__/PhutilUtilsTestCase.php --- a/src/utils/__tests__/PhutilUtilsTestCase.php +++ b/src/utils/__tests__/PhutilUtilsTestCase.php @@ -1070,4 +1070,20 @@ } } + + public function testStringCasting() { + $map = array( + array(123, '123', 'number'), + array(null, '', 'null to empty string'), + array('text', 'text', 'string'), + ); + + foreach ($map as $test_case) { + list($input, $expected_output, $test_name) = $test_case; + + $actual = phutil_string_cast($input); + + $this->assertEqual($expected_output, $actual, $test_name); + } + } }