On 22/02/2021 10:14, Christian Schneider wrote:
Side-note: Maybe we should recommend a function to be used for tests. At my 
work we used to use var_export(), some of our newer tests are using 
json_encode() but neither is really guaranteed to be stable, right?


Well, the obvious choice to me would be var_dump, which is used by the majority of PHP's internal tests (see https://externals.io/message/112967#112971 for some numbers). I was considering putting together a pull request that standardises on that for all bundled extensions, fixing the few hundred (out of thousands) that use var_export or print_r.

However, I've never used PHPT-style tests outside of PHP internals, and for anything like PHPUnit or PHPSpec you would normally be testing against actual PHP values, not any string representation; so I don't really have any opinion on that scenario.

Regards,

--
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to