Page MenuHomePhorge

Add explicit tests for phutil_string_cast
ClosedPublic

Authored by avivey on Jul 3 2023, 18:10.

Details

Summary

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

Test Plan

arc unit

Diff Detail

Repository
rARC Arcanist
Branch
phorge (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 626
Build 626: arc lint + arc unit

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.