Page MenuHomePhorge

Add explicit tests for phutil_string_cast
ClosedPublic

Authored by avivey on Jul 3 2023, 18:10.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 10, 03:18
Unknown Object (File)
Fri, May 10, 00:12
Unknown Object (File)
Fri, May 10, 00:12
Unknown Object (File)
Fri, May 10, 00:12
Unknown Object (File)
Fri, May 10, 00:12
Unknown Object (File)
Wed, May 8, 07:58
Unknown Object (File)
Wed, May 8, 07:33
Unknown Object (File)
Apr 1 2024, 02:16
Tokens
"Love" token, awarded by valerio.bozzolan.

Details

Summary

Test (and document) what phutil_string_cast actually does to some things.

Test Plan

arc unit

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

avivey requested review of this revision.Jul 3 2023, 18:10

Nice. Could we add some additional tests for Boolean true/false, the number zero, populated and empty array?

src/utils/__tests__/PhutilUtilsTestCase.php
1083

that's not what I would have expected, but PHP is special.

This revision is now accepted and ready to land.Jul 3 2023, 21:03

Maybe we can pass also an object that has a __toString() method

Maybe we can pass also an object that has a __toString() method

do you have an example on how to construct one?

In D25326#9471, @avivey wrote:

Maybe we can pass also an object that has a __toString() method

do you have an example on how to construct one?

Don't kill me but I don't remember the names now but we have classes to build URLs, HTML and Remarkup etc. - all of them has __toString() I think.