FriendsOfCake / cakephp-upload

CakePHP: Handle file uploading sans ridiculous automagic
https://cakephp-upload.readthedocs.io/
MIT License
551 stars 255 forks source link

8.x - Fix `afterDelete` expecting an `UploadedFileInterface` object. #603

Closed ndm2 closed 11 months ago

ndm2 commented 11 months ago

Reverts some of #593. The entity read from the DB will not hold uploaded file instances.

ps. I don't have time for it right now, but seeing how this slipped in, the tests are IMHO in dire need of de-mocking. There's so much mocking going on that could possibly hide all sorts of problems, it's wild.

Previously there was for example $this->entity->field being set and passed to expectations, but it was always null, because it's all mocked, still the tests passed because there were no type hints on the arguments where the value would flow through.

codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (44cdcc1) 95.86% compared to head (b61880a) 95.84%. Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #603 +/- ## ============================================ - Coverage 95.86% 95.84% -0.02% Complexity 109 109 ============================================ Files 11 11 Lines 290 289 -1 ============================================ - Hits 278 277 -1 Misses 12 12 ``` | [Files](https://app.codecov.io/gh/FriendsOfCake/cakephp-upload/pull/603?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FriendsOfCake) | Coverage Δ | | |---|---|---| | [src/Model/Behavior/UploadBehavior.php](https://app.codecov.io/gh/FriendsOfCake/cakephp-upload/pull/603?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FriendsOfCake#diff-c3JjL01vZGVsL0JlaGF2aW9yL1VwbG9hZEJlaGF2aW9yLnBocA==) | `95.00% <100.00%> (-0.05%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.