Hi

On 7/12/24 08:00, Rob Landers wrote:
For what it’s worth, I see “resetAsLazy()” being most useful for unit testing 
libraries that build proxies. While this feature will remove most of the tricky 
nuances around proxies, it doesn’t make it any easier in generating the code 
for them, so that has to be tested. Being able to write a test like this 
(abbreviated):

$realObj = new $foo()
$proxy = clone $realObj;
makeTestProxy($proxy); // resets as lazy with initializer
assert($realObj == $proxy);

Is really simple. Without a reset method, this isn’t straightforward.


I'm not sure if I follow this example. With the native support for lazy objects there should no longer be a need for code generation, no? Testing that PHP works correctly in your own test suite is not a value-add, PHP has its own tests for that.

Best regards
Tim Düsterhus

Reply via email to