Closed Arkemlar closed 1 week ago
UPD: I tried to use deep_copy from MyClabs manually:
$notification = deep_copy($notification);
And got such an error:
DeepCopy\Exception\CloneException: The class "App\Billing\Domain\Notification\NotificationProcessStatus" is not cloneable
.
So actually the problem is that MyClabs cloner failed to clone but Phpunit silenced this exception and just skipped test case (or silently died, I dont exactly know). Phpunit should notice us if it fails to clone the object!
UPD2:
It seems that Phpunit actually dies at this exception when using @depends clone
.
Here is my output when I use deep_copy manually and exception raised inside test case scope.
Testing
............................................................... 63 / 252 ( 25%)
............................................................... 126 / 252 ( 50%)
............................................................... 189 / 252 ( 75%)
..........ESSSSS............................................... 252 / 252 (100%)
And here is my output when I use Phpunit's cloning and exception raised somewhere inside its code:
Testing
............................................................... 63 / 252 ( 25%)
............................................................... 126 / 252 ( 50%)
............................................................... 189 / 252 ( 75%)
..........
Is this still an issue? I cannot reproduce it even on branch 8.5
.
Composer deps (some of them):
Summary
Just tried using
@depends clone
and it failed - phpunit just silently skipped that test.Output:
Notification class is a classic object, some fields contains nested objects.
If I remove
clone
word in@depends
or replace it byshallowClone
- then second test will be executed.Current behavior
Phpunit doesn't properly recognize
@depends clone testName
expressionHow to reproduce
Use code above?
Expected behavior
Expected behavior described in documentation and in this issue https://github.com/sebastianbergmann/phpunit/issues/1780
After update (read first comment below) expected behavior is to show some error message or at least passthrough the original DeepCloner's exception but not silence it.